diff --git a/sdk/keyvault/Azure.Management.KeyVault/Azure.Management.KeyVault.sln b/sdk/keyvault/Azure.Management.KeyVault/Azure.Management.KeyVault.sln index d25b9652f4b7..945ee9f0f828 100644 --- a/sdk/keyvault/Azure.Management.KeyVault/Azure.Management.KeyVault.sln +++ b/sdk/keyvault/Azure.Management.KeyVault/Azure.Management.KeyVault.sln @@ -15,7 +15,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Identity", "..\..\ide EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Graph.Rbac", "..\..\testcommon\Azure.Graph.Rbac\src\Azure.Graph.Rbac.csproj", "{4CACB10F-8A47-4BF5-9AA7-C8303D8E4BD2}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Management.Resource", "..\..\testcommon\Azure.Management.Resource.2017_05\src\Azure.Management.Resource.csproj", "{E55AC16E-98FB-4C1F-A873-C9ADDA0896CA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Management.Resources", "..\..\testcommon\Azure.Management.Resources.2017_05\src\Azure.Management.Resources.csproj", "{C6E0B5FC-1382-4BBC-BE76-E7B484C60E52}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -99,18 +99,18 @@ Global {4CACB10F-8A47-4BF5-9AA7-C8303D8E4BD2}.Release|x64.Build.0 = Release|Any CPU {4CACB10F-8A47-4BF5-9AA7-C8303D8E4BD2}.Release|x86.ActiveCfg = Release|Any CPU {4CACB10F-8A47-4BF5-9AA7-C8303D8E4BD2}.Release|x86.Build.0 = Release|Any CPU - {E55AC16E-98FB-4C1F-A873-C9ADDA0896CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E55AC16E-98FB-4C1F-A873-C9ADDA0896CA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E55AC16E-98FB-4C1F-A873-C9ADDA0896CA}.Debug|x64.ActiveCfg = Debug|Any CPU - {E55AC16E-98FB-4C1F-A873-C9ADDA0896CA}.Debug|x64.Build.0 = Debug|Any CPU - {E55AC16E-98FB-4C1F-A873-C9ADDA0896CA}.Debug|x86.ActiveCfg = Debug|Any CPU - {E55AC16E-98FB-4C1F-A873-C9ADDA0896CA}.Debug|x86.Build.0 = Debug|Any CPU - {E55AC16E-98FB-4C1F-A873-C9ADDA0896CA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E55AC16E-98FB-4C1F-A873-C9ADDA0896CA}.Release|Any CPU.Build.0 = Release|Any CPU - {E55AC16E-98FB-4C1F-A873-C9ADDA0896CA}.Release|x64.ActiveCfg = Release|Any CPU - {E55AC16E-98FB-4C1F-A873-C9ADDA0896CA}.Release|x64.Build.0 = Release|Any CPU - {E55AC16E-98FB-4C1F-A873-C9ADDA0896CA}.Release|x86.ActiveCfg = Release|Any CPU - {E55AC16E-98FB-4C1F-A873-C9ADDA0896CA}.Release|x86.Build.0 = Release|Any CPU + {C6E0B5FC-1382-4BBC-BE76-E7B484C60E52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C6E0B5FC-1382-4BBC-BE76-E7B484C60E52}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C6E0B5FC-1382-4BBC-BE76-E7B484C60E52}.Debug|x64.ActiveCfg = Debug|Any CPU + {C6E0B5FC-1382-4BBC-BE76-E7B484C60E52}.Debug|x64.Build.0 = Debug|Any CPU + {C6E0B5FC-1382-4BBC-BE76-E7B484C60E52}.Debug|x86.ActiveCfg = Debug|Any CPU + {C6E0B5FC-1382-4BBC-BE76-E7B484C60E52}.Debug|x86.Build.0 = Debug|Any CPU + {C6E0B5FC-1382-4BBC-BE76-E7B484C60E52}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C6E0B5FC-1382-4BBC-BE76-E7B484C60E52}.Release|Any CPU.Build.0 = Release|Any CPU + {C6E0B5FC-1382-4BBC-BE76-E7B484C60E52}.Release|x64.ActiveCfg = Release|Any CPU + {C6E0B5FC-1382-4BBC-BE76-E7B484C60E52}.Release|x64.Build.0 = Release|Any CPU + {C6E0B5FC-1382-4BBC-BE76-E7B484C60E52}.Release|x86.ActiveCfg = Release|Any CPU + {C6E0B5FC-1382-4BBC-BE76-E7B484C60E52}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/sdk/keyvault/Azure.Management.KeyVault/tests/Azure.Management.KeyVault.Tests.csproj b/sdk/keyvault/Azure.Management.KeyVault/tests/Azure.Management.KeyVault.Tests.csproj index 858988d69dd3..58626b730f41 100644 --- a/sdk/keyvault/Azure.Management.KeyVault/tests/Azure.Management.KeyVault.Tests.csproj +++ b/sdk/keyvault/Azure.Management.KeyVault/tests/Azure.Management.KeyVault.Tests.csproj @@ -2,6 +2,7 @@ + diff --git a/sdk/keyvault/Azure.Management.KeyVault/tests/VaultOperationsTestsBase.cs b/sdk/keyvault/Azure.Management.KeyVault/tests/VaultOperationsTestsBase.cs index 790cf250c458..f51c00466e1b 100644 --- a/sdk/keyvault/Azure.Management.KeyVault/tests/VaultOperationsTestsBase.cs +++ b/sdk/keyvault/Azure.Management.KeyVault/tests/VaultOperationsTestsBase.cs @@ -9,14 +9,13 @@ using Azure.Core.TestFramework; using Azure.Graph.Rbac; using Azure.Management.KeyVault.Models; -using Azure.Management.Resource; +using Azure.Management.Resources; using NUnit.Framework; namespace Azure.Management.KeyVault.Tests { [ClientTestFixture] - [NonParallelizable] public abstract class VaultOperationsTestsBase : RecordedTestBase { private const string ObjectIdKey = "ObjectId"; @@ -96,7 +95,7 @@ protected async Task Initialize() ).First().Locations.FirstOrDefault(); ResGroupName = Recording.GenerateAssetName("sdktestrg"); - await ResourceGroupsClient.CreateOrUpdateAsync(ResGroupName, new Resource.Models.ResourceGroup(Location)); + await ResourceGroupsClient.CreateOrUpdateAsync(ResGroupName, new Resources.Models.ResourceGroup(Location)); VaultName = Recording.GenerateAssetName("sdktestvault"); TenantIdGuid = new Guid(TenantId); @@ -134,11 +133,11 @@ internal KeyVaultManagementClient GetKeyVaultManagementClient() Recording.InstrumentClientOptions(new KeyVaultManagementClientOptions()))); } - internal ResourceManagementClient GetResourceManagementClient() + internal ResourcesManagementClient GetResourceManagementClient() { - return InstrumentClient(new ResourceManagementClient(this.SubscriptionId, + return InstrumentClient(new ResourcesManagementClient(this.SubscriptionId, TestEnvironment.Credential, - Recording.InstrumentClientOptions(new ResourceManagementClientOptions()))); + Recording.InstrumentClientOptions(new ResourcesManagementClientOptions()))); } protected ValueTask> WaitForCompletionAsync(Operation operation) diff --git a/sdk/resources/Azure.Management.Resources/Azure.Management.Resources.sln b/sdk/resources/Azure.Management.Resources/Azure.Management.Resources.sln index 6aab158b4246..60a82c6a1c2b 100644 --- a/sdk/resources/Azure.Management.Resources/Azure.Management.Resources.sln +++ b/sdk/resources/Azure.Management.Resources/Azure.Management.Resources.sln @@ -1,11 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{A7A2395A-F00B-4FAE-8271-38569A2F941A}") = "Azure.Management.Resources", "src\Azure.Management.Resources.csproj", "{702648AD-F126-470D-BE88-5043E189E102}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core", "..\..\core\Azure.Core\src\Azure.Core.csproj", "{856C6092-55EB-4C02-B7D0-9846EDD70745}" EndProject -Project("{A7A2395A-F00B-4FAE-8271-38569A2F941A}") = "Azure.Management.Resources.Tests", "tests\Azure.Management.Resources.Tests.csproj", "{8F603350-192A-483C-9FB9-62FB12FB5ADA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{62AF7C88-CE3F-416E-B18E-BC6F884C89E2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Management.Resources", "src\Azure.Management.Resources.csproj", "{DEFF4395-FBD0-4205-95DE-7992E79015FA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Management.Resources.Tests", "tests\Azure.Management.Resources.Tests.csproj", "{9D842058-41AB-42DD-82C8-F3DF49E25297}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -16,33 +20,60 @@ Global Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|Any CPU.Build.0 = Debug|Any CPU + {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x64.ActiveCfg = Debug|Any CPU + {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x64.Build.0 = Debug|Any CPU + {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x86.ActiveCfg = Debug|Any CPU + {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x86.Build.0 = Debug|Any CPU + {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|Any CPU.ActiveCfg = Release|Any CPU + {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|Any CPU.Build.0 = Release|Any CPU + {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x64.ActiveCfg = Release|Any CPU + {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x64.Build.0 = Release|Any CPU + {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x86.ActiveCfg = Release|Any CPU + {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x86.Build.0 = Release|Any CPU + {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|x64.ActiveCfg = Debug|Any CPU + {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|x64.Build.0 = Debug|Any CPU + {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|x86.ActiveCfg = Debug|Any CPU + {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|x86.Build.0 = Debug|Any CPU + {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Release|Any CPU.Build.0 = Release|Any CPU + {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Release|x64.ActiveCfg = Release|Any CPU + {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Release|x64.Build.0 = Release|Any CPU + {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Release|x86.ActiveCfg = Release|Any CPU + {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Release|x86.Build.0 = Release|Any CPU + {DEFF4395-FBD0-4205-95DE-7992E79015FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DEFF4395-FBD0-4205-95DE-7992E79015FA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DEFF4395-FBD0-4205-95DE-7992E79015FA}.Debug|x64.ActiveCfg = Debug|Any CPU + {DEFF4395-FBD0-4205-95DE-7992E79015FA}.Debug|x64.Build.0 = Debug|Any CPU + {DEFF4395-FBD0-4205-95DE-7992E79015FA}.Debug|x86.ActiveCfg = Debug|Any CPU + {DEFF4395-FBD0-4205-95DE-7992E79015FA}.Debug|x86.Build.0 = Debug|Any CPU + {DEFF4395-FBD0-4205-95DE-7992E79015FA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DEFF4395-FBD0-4205-95DE-7992E79015FA}.Release|Any CPU.Build.0 = Release|Any CPU + {DEFF4395-FBD0-4205-95DE-7992E79015FA}.Release|x64.ActiveCfg = Release|Any CPU + {DEFF4395-FBD0-4205-95DE-7992E79015FA}.Release|x64.Build.0 = Release|Any CPU + {DEFF4395-FBD0-4205-95DE-7992E79015FA}.Release|x86.ActiveCfg = Release|Any CPU + {DEFF4395-FBD0-4205-95DE-7992E79015FA}.Release|x86.Build.0 = Release|Any CPU + {9D842058-41AB-42DD-82C8-F3DF49E25297}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D842058-41AB-42DD-82C8-F3DF49E25297}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D842058-41AB-42DD-82C8-F3DF49E25297}.Debug|x64.ActiveCfg = Debug|Any CPU + {9D842058-41AB-42DD-82C8-F3DF49E25297}.Debug|x64.Build.0 = Debug|Any CPU + {9D842058-41AB-42DD-82C8-F3DF49E25297}.Debug|x86.ActiveCfg = Debug|Any CPU + {9D842058-41AB-42DD-82C8-F3DF49E25297}.Debug|x86.Build.0 = Debug|Any CPU + {9D842058-41AB-42DD-82C8-F3DF49E25297}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D842058-41AB-42DD-82C8-F3DF49E25297}.Release|Any CPU.Build.0 = Release|Any CPU + {9D842058-41AB-42DD-82C8-F3DF49E25297}.Release|x64.ActiveCfg = Release|Any CPU + {9D842058-41AB-42DD-82C8-F3DF49E25297}.Release|x64.Build.0 = Release|Any CPU + {9D842058-41AB-42DD-82C8-F3DF49E25297}.Release|x86.ActiveCfg = Release|Any CPU + {9D842058-41AB-42DD-82C8-F3DF49E25297}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {702648AD-F126-470D-BE88-5043E189E102}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {702648AD-F126-470D-BE88-5043E189E102}.Debug|Any CPU.Build.0 = Debug|Any CPU - {702648AD-F126-470D-BE88-5043E189E102}.Debug|x64.ActiveCfg = Debug|Any CPU - {702648AD-F126-470D-BE88-5043E189E102}.Debug|x64.Build.0 = Debug|Any CPU - {702648AD-F126-470D-BE88-5043E189E102}.Debug|x86.ActiveCfg = Debug|Any CPU - {702648AD-F126-470D-BE88-5043E189E102}.Debug|x86.Build.0 = Debug|Any CPU - {702648AD-F126-470D-BE88-5043E189E102}.Release|Any CPU.ActiveCfg = Release|Any CPU - {702648AD-F126-470D-BE88-5043E189E102}.Release|Any CPU.Build.0 = Release|Any CPU - {702648AD-F126-470D-BE88-5043E189E102}.Release|x64.ActiveCfg = Release|Any CPU - {702648AD-F126-470D-BE88-5043E189E102}.Release|x64.Build.0 = Release|Any CPU - {702648AD-F126-470D-BE88-5043E189E102}.Release|x86.ActiveCfg = Release|Any CPU - {702648AD-F126-470D-BE88-5043E189E102}.Release|x86.Build.0 = Release|Any CPU - {8F603350-192A-483C-9FB9-62FB12FB5ADA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8F603350-192A-483C-9FB9-62FB12FB5ADA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8F603350-192A-483C-9FB9-62FB12FB5ADA}.Debug|x64.ActiveCfg = Debug|Any CPU - {8F603350-192A-483C-9FB9-62FB12FB5ADA}.Debug|x64.Build.0 = Debug|Any CPU - {8F603350-192A-483C-9FB9-62FB12FB5ADA}.Debug|x86.ActiveCfg = Debug|Any CPU - {8F603350-192A-483C-9FB9-62FB12FB5ADA}.Debug|x86.Build.0 = Debug|Any CPU - {8F603350-192A-483C-9FB9-62FB12FB5ADA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8F603350-192A-483C-9FB9-62FB12FB5ADA}.Release|Any CPU.Build.0 = Release|Any CPU - {8F603350-192A-483C-9FB9-62FB12FB5ADA}.Release|x64.ActiveCfg = Release|Any CPU - {8F603350-192A-483C-9FB9-62FB12FB5ADA}.Release|x64.Build.0 = Release|Any CPU - {8F603350-192A-483C-9FB9-62FB12FB5ADA}.Release|x86.ActiveCfg = Release|Any CPU - {8F603350-192A-483C-9FB9-62FB12FB5ADA}.Release|x86.Build.0 = Release|Any CPU + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {62EFD6CB-604F-4B35-8816-C10DF346E98E} EndGlobalSection EndGlobal diff --git a/sdk/resources/Azure.Management.Resources/CHANGELOG.md b/sdk/resources/Azure.Management.Resources/CHANGELOG.md index 0c771dd35ce7..1b317bfa6f40 100644 --- a/sdk/resources/Azure.Management.Resources/CHANGELOG.md +++ b/sdk/resources/Azure.Management.Resources/CHANGELOG.md @@ -3,4 +3,4 @@ ## 1.0.0-preview.1 ### New Features -- Initial preview of Azure Management SDK based on Azure.Core \ No newline at end of file +- Initial preview of Azure Management SDK based on Azure.Core diff --git a/sdk/resources/Azure.Management.Resources/README.md b/sdk/resources/Azure.Management.Resources/README.md index 3f46b790f26c..1b60647bdb4d 100644 --- a/sdk/resources/Azure.Management.Resources/README.md +++ b/sdk/resources/Azure.Management.Resources/README.md @@ -5,7 +5,7 @@ Use the guidelines in each section of this template to ensure consistency and re * All headings, including the H1, should use **sentence-style capitalization**. Refer to the [Microsoft Style Guide][style-guide-msft] and [Microsoft Cloud Style Guide][style-guide-cloud] for more information. * Example: `# Azure Batch client library for Python` -# Azure Management Resources client library for .NET +# Azure Management Resource client library for .NET **Introduction**: The introduction appears directly under the title (H1) of your README. @@ -44,14 +44,6 @@ The *Key concepts* section should describe the functionality of the main classes Include code snippets and short descriptions for each task you listed in the [Introduction](#introduction) (the bulleted list). Briefly explain each operation, but include enough clarity to explain complex or otherwise tricky operations. -If possible, use the same example snippets that your in-code documentation uses. For example, use the snippets in your `examples.py` that Sphinx ingests via its [literalinclude](https://www.sphinx-doc.org/en/1.5/markup/code.html?highlight=code%20examples#includes) directive. The `examples.py` file containing the snippets should reside alongside your package's code, and should be tested in an automated fashion. - -Each example in the *Examples* section starts with an H3 that describes the example. At the top of this section, just under the *Examples* H2, add a bulleted list linking to each example H3. Each example should deep-link to the types and/or members used in the example. - -* [Create the thing](#create-the-thing) -* [Get the thing](#get-the-thing) -* [List the things](#list-the-things) - ## Troubleshooting Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery. diff --git a/sdk/resources/Azure.Management.Resources/api/Azure.Management.Resources.netstandard2.0.cs b/sdk/resources/Azure.Management.Resources/api/Azure.Management.Resources.netstandard2.0.cs index e69de29bb2d1..59c6f719e232 100644 --- a/sdk/resources/Azure.Management.Resources/api/Azure.Management.Resources.netstandard2.0.cs +++ b/sdk/resources/Azure.Management.Resources/api/Azure.Management.Resources.netstandard2.0.cs @@ -0,0 +1,2323 @@ +namespace Azure.Management.Resources +{ + public partial class ApplicationDefinitionsClient + { + protected ApplicationDefinitionsClient() { } + public virtual Azure.Response Get(string resourceGroupName, string applicationDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceGroupName, string applicationDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetById(string applicationDefinitionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetByIdAsync(string applicationDefinitionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListByResourceGroup(string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListByResourceGroupAsync(string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ApplicationDefinitionsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string applicationDefinitionName, Azure.Management.Resources.Models.ApplicationDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartCreateOrUpdateAsync(string resourceGroupName, string applicationDefinitionName, Azure.Management.Resources.Models.ApplicationDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ApplicationDefinitionsCreateOrUpdateByIdOperation StartCreateOrUpdateById(string applicationDefinitionId, Azure.Management.Resources.Models.ApplicationDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartCreateOrUpdateByIdAsync(string applicationDefinitionId, Azure.Management.Resources.Models.ApplicationDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ApplicationDefinitionsDeleteOperation StartDelete(string resourceGroupName, string applicationDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartDeleteAsync(string resourceGroupName, string applicationDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ApplicationDefinitionsDeleteByIdOperation StartDeleteById(string applicationDefinitionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartDeleteByIdAsync(string applicationDefinitionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ApplicationDefinitionsCreateOrUpdateByIdOperation : Azure.Operation + { + internal ApplicationDefinitionsCreateOrUpdateByIdOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.ApplicationDefinition Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ApplicationDefinitionsCreateOrUpdateOperation : Azure.Operation + { + internal ApplicationDefinitionsCreateOrUpdateOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.ApplicationDefinition Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ApplicationDefinitionsDeleteByIdOperation : Azure.Operation + { + internal ApplicationDefinitionsDeleteByIdOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ApplicationDefinitionsDeleteOperation : Azure.Operation + { + internal ApplicationDefinitionsDeleteOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ApplicationsClient + { + protected ApplicationsClient() { } + public virtual Azure.Response Get(string resourceGroupName, string applicationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceGroupName, string applicationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetById(string applicationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetByIdAsync(string applicationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListByResourceGroup(string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListByResourceGroupAsync(string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListBySubscription(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListBySubscriptionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ApplicationsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string applicationName, Azure.Management.Resources.Models.Application parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartCreateOrUpdateAsync(string resourceGroupName, string applicationName, Azure.Management.Resources.Models.Application parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ApplicationsCreateOrUpdateByIdOperation StartCreateOrUpdateById(string applicationId, Azure.Management.Resources.Models.Application parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartCreateOrUpdateByIdAsync(string applicationId, Azure.Management.Resources.Models.Application parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ApplicationsDeleteOperation StartDelete(string resourceGroupName, string applicationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartDeleteAsync(string resourceGroupName, string applicationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ApplicationsDeleteByIdOperation StartDeleteById(string applicationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartDeleteByIdAsync(string applicationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Update(string resourceGroupName, string applicationName, Azure.Management.Resources.Models.Application parameters = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(string resourceGroupName, string applicationName, Azure.Management.Resources.Models.Application parameters = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateById(string applicationId, Azure.Management.Resources.Models.Application parameters = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateByIdAsync(string applicationId, Azure.Management.Resources.Models.Application parameters = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ApplicationsCreateOrUpdateByIdOperation : Azure.Operation + { + internal ApplicationsCreateOrUpdateByIdOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.Application Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ApplicationsCreateOrUpdateOperation : Azure.Operation + { + internal ApplicationsCreateOrUpdateOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.Application Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ApplicationsDeleteByIdOperation : Azure.Operation + { + internal ApplicationsDeleteByIdOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ApplicationsDeleteOperation : Azure.Operation + { + internal ApplicationsDeleteOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AuthorizationClient + { + protected AuthorizationClient() { } + public virtual Azure.Pageable List(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentClient + { + protected DeploymentClient() { } + public virtual Azure.Response Get(string resourceGroupName, string deploymentName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceGroupName, string deploymentName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtManagementGroupScope(string groupId, string deploymentName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtManagementGroupScopeAsync(string groupId, string deploymentName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtScope(string scope, string deploymentName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtScopeAsync(string scope, string deploymentName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtSubscriptionScope(string deploymentName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtSubscriptionScopeAsync(string deploymentName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtTenantScope(string deploymentName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtTenantScopeAsync(string deploymentName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable List(string resourceGroupName, string deploymentName, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAsync(string resourceGroupName, string deploymentName, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtManagementGroupScope(string groupId, string deploymentName, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtManagementGroupScopeAsync(string groupId, string deploymentName, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtScope(string scope, string deploymentName, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtScopeAsync(string scope, string deploymentName, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtSubscriptionScope(string deploymentName, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtSubscriptionScopeAsync(string deploymentName, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtTenantScope(string deploymentName, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtTenantScopeAsync(string deploymentName, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsClient + { + protected DeploymentsClient() { } + public virtual Azure.Response CalculateTemplateHash(object template, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CalculateTemplateHashAsync(object template, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Cancel(string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CancelAsync(string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CancelAtManagementGroupScope(string groupId, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CancelAtManagementGroupScopeAsync(string groupId, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CancelAtScope(string scope, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CancelAtScopeAsync(string scope, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CancelAtSubscriptionScope(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CancelAtSubscriptionScopeAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CancelAtTenantScope(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CancelAtTenantScopeAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckExistence(string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckExistenceAsync(string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckExistenceAtManagementGroupScope(string groupId, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckExistenceAtManagementGroupScopeAsync(string groupId, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckExistenceAtScope(string scope, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckExistenceAtScopeAsync(string scope, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckExistenceAtSubscriptionScope(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckExistenceAtSubscriptionScopeAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckExistenceAtTenantScope(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckExistenceAtTenantScopeAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ExportTemplate(string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExportTemplateAsync(string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ExportTemplateAtManagementGroupScope(string groupId, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExportTemplateAtManagementGroupScopeAsync(string groupId, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ExportTemplateAtScope(string scope, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExportTemplateAtScopeAsync(string scope, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ExportTemplateAtSubscriptionScope(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExportTemplateAtSubscriptionScopeAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ExportTemplateAtTenantScope(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExportTemplateAtTenantScopeAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtManagementGroupScope(string groupId, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtManagementGroupScopeAsync(string groupId, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtScope(string scope, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtScopeAsync(string scope, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtSubscriptionScope(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtSubscriptionScopeAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtTenantScope(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtTenantScopeAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtManagementGroupScope(string groupId, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtManagementGroupScopeAsync(string groupId, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtScope(string scope, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtScopeAsync(string scope, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtSubscriptionScope(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtSubscriptionScopeAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtTenantScope(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtTenantScopeAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListByResourceGroup(string resourceGroupName, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListByResourceGroupAsync(string resourceGroupName, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string deploymentName, Azure.Management.Resources.Models.Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartCreateOrUpdateAsync(string resourceGroupName, string deploymentName, Azure.Management.Resources.Models.Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsCreateOrUpdateAtManagementGroupScopeOperation StartCreateOrUpdateAtManagementGroupScope(string groupId, string deploymentName, Azure.Management.Resources.Models.ScopedDeployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartCreateOrUpdateAtManagementGroupScopeAsync(string groupId, string deploymentName, Azure.Management.Resources.Models.ScopedDeployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsCreateOrUpdateAtScopeOperation StartCreateOrUpdateAtScope(string scope, string deploymentName, Azure.Management.Resources.Models.Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartCreateOrUpdateAtScopeAsync(string scope, string deploymentName, Azure.Management.Resources.Models.Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsCreateOrUpdateAtSubscriptionScopeOperation StartCreateOrUpdateAtSubscriptionScope(string deploymentName, Azure.Management.Resources.Models.Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartCreateOrUpdateAtSubscriptionScopeAsync(string deploymentName, Azure.Management.Resources.Models.Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsCreateOrUpdateAtTenantScopeOperation StartCreateOrUpdateAtTenantScope(string deploymentName, Azure.Management.Resources.Models.ScopedDeployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartCreateOrUpdateAtTenantScopeAsync(string deploymentName, Azure.Management.Resources.Models.ScopedDeployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsDeleteOperation StartDelete(string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartDeleteAsync(string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsDeleteAtManagementGroupScopeOperation StartDeleteAtManagementGroupScope(string groupId, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartDeleteAtManagementGroupScopeAsync(string groupId, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsDeleteAtScopeOperation StartDeleteAtScope(string scope, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartDeleteAtScopeAsync(string scope, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsDeleteAtSubscriptionScopeOperation StartDeleteAtSubscriptionScope(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartDeleteAtSubscriptionScopeAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsDeleteAtTenantScopeOperation StartDeleteAtTenantScope(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartDeleteAtTenantScopeAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsValidateOperation StartValidate(string resourceGroupName, string deploymentName, Azure.Management.Resources.Models.Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartValidateAsync(string resourceGroupName, string deploymentName, Azure.Management.Resources.Models.Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsValidateAtManagementGroupScopeOperation StartValidateAtManagementGroupScope(string groupId, string deploymentName, Azure.Management.Resources.Models.ScopedDeployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartValidateAtManagementGroupScopeAsync(string groupId, string deploymentName, Azure.Management.Resources.Models.ScopedDeployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsValidateAtScopeOperation StartValidateAtScope(string scope, string deploymentName, Azure.Management.Resources.Models.Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartValidateAtScopeAsync(string scope, string deploymentName, Azure.Management.Resources.Models.Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsValidateAtSubscriptionScopeOperation StartValidateAtSubscriptionScope(string deploymentName, Azure.Management.Resources.Models.Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartValidateAtSubscriptionScopeAsync(string deploymentName, Azure.Management.Resources.Models.Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsValidateAtTenantScopeOperation StartValidateAtTenantScope(string deploymentName, Azure.Management.Resources.Models.ScopedDeployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartValidateAtTenantScopeAsync(string deploymentName, Azure.Management.Resources.Models.ScopedDeployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsWhatIfOperation StartWhatIf(string resourceGroupName, string deploymentName, Azure.Management.Resources.Models.DeploymentWhatIf parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartWhatIfAsync(string resourceGroupName, string deploymentName, Azure.Management.Resources.Models.DeploymentWhatIf parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentsWhatIfAtSubscriptionScopeOperation StartWhatIfAtSubscriptionScope(string deploymentName, Azure.Management.Resources.Models.DeploymentWhatIf parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartWhatIfAtSubscriptionScopeAsync(string deploymentName, Azure.Management.Resources.Models.DeploymentWhatIf parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsCreateOrUpdateAtManagementGroupScopeOperation : Azure.Operation + { + internal DeploymentsCreateOrUpdateAtManagementGroupScopeOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.DeploymentExtended Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsCreateOrUpdateAtScopeOperation : Azure.Operation + { + internal DeploymentsCreateOrUpdateAtScopeOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.DeploymentExtended Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsCreateOrUpdateAtSubscriptionScopeOperation : Azure.Operation + { + internal DeploymentsCreateOrUpdateAtSubscriptionScopeOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.DeploymentExtended Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsCreateOrUpdateAtTenantScopeOperation : Azure.Operation + { + internal DeploymentsCreateOrUpdateAtTenantScopeOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.DeploymentExtended Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsCreateOrUpdateOperation : Azure.Operation + { + internal DeploymentsCreateOrUpdateOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.DeploymentExtended Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentScriptsClient + { + protected DeploymentScriptsClient() { } + public virtual Azure.Response Delete(string resourceGroupName, string scriptName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string resourceGroupName, string scriptName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string resourceGroupName, string scriptName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceGroupName, string scriptName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetLogs(string resourceGroupName, string scriptName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLogsAsync(string resourceGroupName, string scriptName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetLogsDefault(string resourceGroupName, string scriptName, int? tail = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLogsDefaultAsync(string resourceGroupName, string scriptName, int? tail = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListByResourceGroup(string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListByResourceGroupAsync(string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListBySubscription(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListBySubscriptionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.DeploymentScriptsCreateOperation StartCreate(string resourceGroupName, string scriptName, Azure.Management.Resources.Models.DeploymentScript deploymentScript, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartCreateAsync(string resourceGroupName, string scriptName, Azure.Management.Resources.Models.DeploymentScript deploymentScript, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Update(string resourceGroupName, string scriptName, Azure.Management.Resources.Models.DeploymentScriptUpdateParameter deploymentScript = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(string resourceGroupName, string scriptName, Azure.Management.Resources.Models.DeploymentScriptUpdateParameter deploymentScript = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentScriptsCreateOperation : Azure.Operation + { + internal DeploymentScriptsCreateOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.DeploymentScript Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsDeleteAtManagementGroupScopeOperation : Azure.Operation + { + internal DeploymentsDeleteAtManagementGroupScopeOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsDeleteAtScopeOperation : Azure.Operation + { + internal DeploymentsDeleteAtScopeOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsDeleteAtSubscriptionScopeOperation : Azure.Operation + { + internal DeploymentsDeleteAtSubscriptionScopeOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsDeleteAtTenantScopeOperation : Azure.Operation + { + internal DeploymentsDeleteAtTenantScopeOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsDeleteOperation : Azure.Operation + { + internal DeploymentsDeleteOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsValidateAtManagementGroupScopeOperation : Azure.Operation + { + internal DeploymentsValidateAtManagementGroupScopeOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.DeploymentValidateResult Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsValidateAtScopeOperation : Azure.Operation + { + internal DeploymentsValidateAtScopeOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.DeploymentValidateResult Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsValidateAtSubscriptionScopeOperation : Azure.Operation + { + internal DeploymentsValidateAtSubscriptionScopeOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.DeploymentValidateResult Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsValidateAtTenantScopeOperation : Azure.Operation + { + internal DeploymentsValidateAtTenantScopeOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.DeploymentValidateResult Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsValidateOperation : Azure.Operation + { + internal DeploymentsValidateOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.DeploymentValidateResult Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsWhatIfAtSubscriptionScopeOperation : Azure.Operation + { + internal DeploymentsWhatIfAtSubscriptionScopeOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.WhatIfOperationResult Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeploymentsWhatIfOperation : Azure.Operation + { + internal DeploymentsWhatIfOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.WhatIfOperationResult Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class FeaturesClient + { + protected FeaturesClient() { } + public virtual Azure.Response Get(string resourceProviderNamespace, string featureName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceProviderNamespace, string featureName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable List(string resourceProviderNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAsync(string resourceProviderNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Register(string resourceProviderNamespace, string featureName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RegisterAsync(string resourceProviderNamespace, string featureName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Unregister(string resourceProviderNamespace, string featureName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UnregisterAsync(string resourceProviderNamespace, string featureName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ManagementLocksClient + { + protected ManagementLocksClient() { } + public virtual Azure.Response CreateOrUpdateAtResourceGroupLevel(string resourceGroupName, string lockName, Azure.Management.Resources.Models.ManagementLockObject parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAtResourceGroupLevelAsync(string resourceGroupName, string lockName, Azure.Management.Resources.Models.ManagementLockObject parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, Azure.Management.Resources.Models.ManagementLockObject parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAtResourceLevelAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, Azure.Management.Resources.Models.ManagementLockObject parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateAtSubscriptionLevel(string lockName, Azure.Management.Resources.Models.ManagementLockObject parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAtSubscriptionLevelAsync(string lockName, Azure.Management.Resources.Models.ManagementLockObject parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateByScope(string scope, string lockName, Azure.Management.Resources.Models.ManagementLockObject parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateByScopeAsync(string scope, string lockName, Azure.Management.Resources.Models.ManagementLockObject parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteAtResourceGroupLevel(string resourceGroupName, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAtResourceGroupLevelAsync(string resourceGroupName, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAtResourceLevelAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteAtSubscriptionLevel(string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAtSubscriptionLevelAsync(string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteByScope(string scope, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteByScopeAsync(string scope, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtResourceGroupLevel(string resourceGroupName, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtResourceGroupLevelAsync(string resourceGroupName, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtResourceLevelAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtSubscriptionLevel(string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtSubscriptionLevelAsync(string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetByScope(string scope, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetByScopeAsync(string scope, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtResourceGroupLevel(string resourceGroupName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtResourceGroupLevelAsync(string resourceGroupName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtResourceLevelAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtSubscriptionLevel(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtSubscriptionLevelAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListByScope(string scope, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListByScopeAsync(string scope, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class OperationsClient + { + protected OperationsClient() { } + public virtual Azure.Pageable List(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class PolicyAssignmentsClient + { + protected PolicyAssignmentsClient() { } + public virtual Azure.Response Create(string scope, string policyAssignmentName, Azure.Management.Resources.Models.PolicyAssignment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateAsync(string scope, string policyAssignmentName, Azure.Management.Resources.Models.PolicyAssignment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateById(string policyAssignmentId, Azure.Management.Resources.Models.PolicyAssignment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateByIdAsync(string policyAssignmentId, Azure.Management.Resources.Models.PolicyAssignment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Delete(string scope, string policyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteAsync(string scope, string policyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteById(string policyAssignmentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteByIdAsync(string policyAssignmentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string scope, string policyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string scope, string policyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetById(string policyAssignmentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetByIdAsync(string policyAssignmentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable List(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListForManagementGroup(string managementGroupId, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListForManagementGroupAsync(string managementGroupId, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListForResource(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListForResourceAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListForResourceGroup(string resourceGroupName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListForResourceGroupAsync(string resourceGroupName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class PolicyDefinitionsClient + { + protected PolicyDefinitionsClient() { } + public virtual Azure.Response CreateOrUpdate(string policyDefinitionName, Azure.Management.Resources.Models.PolicyDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(string policyDefinitionName, Azure.Management.Resources.Models.PolicyDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateAtManagementGroup(string policyDefinitionName, string managementGroupId, Azure.Management.Resources.Models.PolicyDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAtManagementGroupAsync(string policyDefinitionName, string managementGroupId, Azure.Management.Resources.Models.PolicyDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Delete(string policyDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string policyDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteAtManagementGroup(string policyDefinitionName, string managementGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAtManagementGroupAsync(string policyDefinitionName, string managementGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string policyDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string policyDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtManagementGroup(string policyDefinitionName, string managementGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtManagementGroupAsync(string policyDefinitionName, string managementGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetBuiltIn(string policyDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBuiltInAsync(string policyDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable List(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListBuiltIn(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListBuiltInAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListByManagementGroup(string managementGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListByManagementGroupAsync(string managementGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class PolicySetDefinitionsClient + { + protected PolicySetDefinitionsClient() { } + public virtual Azure.Response CreateOrUpdate(string policySetDefinitionName, Azure.Management.Resources.Models.PolicySetDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(string policySetDefinitionName, Azure.Management.Resources.Models.PolicySetDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateAtManagementGroup(string policySetDefinitionName, string managementGroupId, Azure.Management.Resources.Models.PolicySetDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAtManagementGroupAsync(string policySetDefinitionName, string managementGroupId, Azure.Management.Resources.Models.PolicySetDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Delete(string policySetDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string policySetDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteAtManagementGroup(string policySetDefinitionName, string managementGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAtManagementGroupAsync(string policySetDefinitionName, string managementGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string policySetDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string policySetDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtManagementGroup(string policySetDefinitionName, string managementGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtManagementGroupAsync(string policySetDefinitionName, string managementGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetBuiltIn(string policySetDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBuiltInAsync(string policySetDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable List(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListBuiltIn(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListBuiltInAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListByManagementGroup(string managementGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListByManagementGroupAsync(string managementGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ProvidersClient + { + protected ProvidersClient() { } + public virtual Azure.Response Get(string resourceProviderNamespace, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceProviderNamespace, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtTenantScope(string resourceProviderNamespace, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtTenantScopeAsync(string resourceProviderNamespace, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable List(int? top = default(int?), string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAsync(int? top = default(int?), string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtTenantScope(int? top = default(int?), string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtTenantScopeAsync(int? top = default(int?), string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Register(string resourceProviderNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RegisterAsync(string resourceProviderNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Unregister(string resourceProviderNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UnregisterAsync(string resourceProviderNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourceGroupsClient + { + protected ResourceGroupsClient() { } + public virtual Azure.Response CheckExistence(string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckExistenceAsync(string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdate(string resourceGroupName, Azure.Management.Resources.Models.ResourceGroup parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(string resourceGroupName, Azure.Management.Resources.Models.ResourceGroup parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable List(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ResourceGroupsDeleteOperation StartDelete(string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartDeleteAsync(string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ResourceGroupsExportTemplateOperation StartExportTemplate(string resourceGroupName, Azure.Management.Resources.Models.ExportTemplateRequest parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartExportTemplateAsync(string resourceGroupName, Azure.Management.Resources.Models.ExportTemplateRequest parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Update(string resourceGroupName, Azure.Management.Resources.Models.ResourceGroupPatchable parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(string resourceGroupName, Azure.Management.Resources.Models.ResourceGroupPatchable parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourceGroupsDeleteOperation : Azure.Operation + { + internal ResourceGroupsDeleteOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourceGroupsExportTemplateOperation : Azure.Operation + { + internal ResourceGroupsExportTemplateOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.ResourceGroupExportResult Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourceLinksClient + { + protected ResourceLinksClient() { } + public virtual Azure.Response CreateOrUpdate(string linkId, Azure.Management.Resources.Models.ResourceLink parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(string linkId, Azure.Management.Resources.Models.ResourceLink parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Delete(string linkId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string linkId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string linkId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string linkId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtSourceScope(string scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtSourceScopeAsync(string scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListAtSubscription(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAtSubscriptionAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourcesClient + { + protected ResourcesClient() { } + public virtual Azure.Response CheckExistence(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckExistenceAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckExistenceById(string resourceId, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckExistenceByIdAsync(string resourceId, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetById(string resourceId, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetByIdAsync(string resourceId, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable List(string filter = null, string expand = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAsync(string filter = null, string expand = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListByResourceGroup(string resourceGroupName, string filter = null, string expand = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListByResourceGroupAsync(string resourceGroupName, string filter = null, string expand = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ResourcesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, Azure.Management.Resources.Models.GenericResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartCreateOrUpdateAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, Azure.Management.Resources.Models.GenericResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ResourcesCreateOrUpdateByIdOperation StartCreateOrUpdateById(string resourceId, string apiVersion, Azure.Management.Resources.Models.GenericResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartCreateOrUpdateByIdAsync(string resourceId, string apiVersion, Azure.Management.Resources.Models.GenericResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ResourcesDeleteOperation StartDelete(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartDeleteAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ResourcesDeleteByIdOperation StartDeleteById(string resourceId, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartDeleteByIdAsync(string resourceId, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ResourcesMoveResourcesOperation StartMoveResources(string sourceResourceGroupName, Azure.Management.Resources.Models.ResourcesMoveInfo parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartMoveResourcesAsync(string sourceResourceGroupName, Azure.Management.Resources.Models.ResourcesMoveInfo parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ResourcesUpdateOperation StartUpdate(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, Azure.Management.Resources.Models.GenericResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartUpdateAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, Azure.Management.Resources.Models.GenericResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ResourcesUpdateByIdOperation StartUpdateById(string resourceId, string apiVersion, Azure.Management.Resources.Models.GenericResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartUpdateByIdAsync(string resourceId, string apiVersion, Azure.Management.Resources.Models.GenericResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Management.Resources.ResourcesValidateMoveResourcesOperation StartValidateMoveResources(string sourceResourceGroupName, Azure.Management.Resources.Models.ResourcesMoveInfo parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.ValueTask StartValidateMoveResourcesAsync(string sourceResourceGroupName, Azure.Management.Resources.Models.ResourcesMoveInfo parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourcesCreateOrUpdateByIdOperation : Azure.Operation + { + internal ResourcesCreateOrUpdateByIdOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.GenericResource Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourcesCreateOrUpdateOperation : Azure.Operation + { + internal ResourcesCreateOrUpdateOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.GenericResource Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourcesDeleteByIdOperation : Azure.Operation + { + internal ResourcesDeleteByIdOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourcesDeleteOperation : Azure.Operation + { + internal ResourcesDeleteOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourcesManagementClient + { + protected ResourcesManagementClient() { } + public ResourcesManagementClient(string subscriptionId, Azure.Core.TokenCredential tokenCredential, Azure.Management.Resources.ResourcesManagementClientOptions options = null) { } + public ResourcesManagementClient(System.Uri endpoint, string subscriptionId, Azure.Core.TokenCredential tokenCredential, Azure.Management.Resources.ResourcesManagementClientOptions options = null) { } + public virtual Azure.Management.Resources.ApplicationDefinitionsClient GetApplicationDefinitionsClient() { throw null; } + public virtual Azure.Management.Resources.ApplicationsClient GetApplicationsClient() { throw null; } + public virtual Azure.Management.Resources.AuthorizationClient GetAuthorizationClient() { throw null; } + public virtual Azure.Management.Resources.DeploymentClient GetDeploymentClient() { throw null; } + public virtual Azure.Management.Resources.DeploymentsClient GetDeploymentsClient() { throw null; } + public virtual Azure.Management.Resources.DeploymentScriptsClient GetDeploymentScriptsClient() { throw null; } + public virtual Azure.Management.Resources.FeaturesClient GetFeaturesClient() { throw null; } + public virtual Azure.Management.Resources.ManagementLocksClient GetManagementLocksClient() { throw null; } + public virtual Azure.Management.Resources.OperationsClient GetOperationsClient() { throw null; } + public virtual Azure.Management.Resources.PolicyAssignmentsClient GetPolicyAssignmentsClient() { throw null; } + public virtual Azure.Management.Resources.PolicyDefinitionsClient GetPolicyDefinitionsClient() { throw null; } + public virtual Azure.Management.Resources.PolicySetDefinitionsClient GetPolicySetDefinitionsClient() { throw null; } + public virtual Azure.Management.Resources.ProvidersClient GetProvidersClient() { throw null; } + public virtual Azure.Management.Resources.ResourceGroupsClient GetResourceGroupsClient() { throw null; } + public virtual Azure.Management.Resources.ResourceLinksClient GetResourceLinksClient() { throw null; } + public virtual Azure.Management.Resources.ResourcesClient GetResourcesClient() { throw null; } + public virtual Azure.Management.Resources.ServiceClient GetServiceClient() { throw null; } + public virtual Azure.Management.Resources.SubscriptionsClient GetSubscriptionsClient() { throw null; } + public virtual Azure.Management.Resources.TagsClient GetTagsClient() { throw null; } + public virtual Azure.Management.Resources.TenantsClient GetTenantsClient() { throw null; } + } + public partial class ResourcesManagementClientOptions : Azure.Core.ClientOptions + { + public ResourcesManagementClientOptions() { } + } + public partial class ResourcesMoveResourcesOperation : Azure.Operation + { + internal ResourcesMoveResourcesOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourcesUpdateByIdOperation : Azure.Operation + { + internal ResourcesUpdateByIdOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.GenericResource Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourcesUpdateOperation : Azure.Operation + { + internal ResourcesUpdateOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Management.Resources.Models.GenericResource Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourcesValidateMoveResourcesOperation : Azure.Operation + { + internal ResourcesValidateMoveResourcesOperation() { } + public override bool HasCompleted { get { throw null; } } + public override bool HasValue { get { throw null; } } + public override string Id { get { throw null; } } + public override Azure.Response Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ServiceClient + { + protected ServiceClient() { } + public virtual Azure.Pageable ListOperations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListOperationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SubscriptionsClient + { + protected SubscriptionsClient() { } + public virtual Azure.Response Get(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable List(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListLocations(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListLocationsAsync(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class TagsClient + { + protected TagsClient() { } + public virtual Azure.Response CreateOrUpdate(string tagName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(string tagName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateAtScope(string scope, Azure.Management.Resources.Models.TagsResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAtScopeAsync(string scope, Azure.Management.Resources.Models.TagsResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateValue(string tagName, string tagValue, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateValueAsync(string tagName, string tagValue, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Delete(string tagName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string tagName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteAtScope(string scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAtScopeAsync(string scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteValue(string tagName, string tagValue, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteValueAsync(string tagName, string tagValue, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAtScope(string scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAtScopeAsync(string scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable List(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateAtScope(string scope, Azure.Management.Resources.Models.TagsPatchResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAtScopeAsync(string scope, Azure.Management.Resources.Models.TagsPatchResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class TenantsClient + { + protected TenantsClient() { } + public virtual Azure.Pageable List(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.Management.Resources.Models +{ + public partial class Alias + { + internal Alias() { } + public string DefaultPath { get { throw null; } } + public Azure.Management.Resources.Models.AliasPattern DefaultPattern { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Paths { get { throw null; } } + public Azure.Management.Resources.Models.AliasType? Type { get { throw null; } } + } + public partial class AliasPath + { + internal AliasPath() { } + public System.Collections.Generic.IReadOnlyList ApiVersions { get { throw null; } } + public string Path { get { throw null; } } + public Azure.Management.Resources.Models.AliasPattern Pattern { get { throw null; } } + } + public partial class AliasPattern + { + internal AliasPattern() { } + public string Phrase { get { throw null; } } + public Azure.Management.Resources.Models.AliasPatternType? Type { get { throw null; } } + public string Variable { get { throw null; } } + } + public enum AliasPatternType + { + NotSpecified = 0, + Extract = 1, + } + public enum AliasType + { + NotSpecified = 0, + PlainText = 1, + Mask = 2, + } + public partial class Application : Azure.Management.Resources.Models.GenericResourceAutoGenerated + { + public Application(string kind, string managedResourceGroupId) { } + public string ApplicationDefinitionId { get { throw null; } set { } } + public string Kind { get { throw null; } set { } } + public string ManagedResourceGroupId { get { throw null; } set { } } + public object Outputs { get { throw null; } } + public object Parameters { get { throw null; } set { } } + public Azure.Management.Resources.Models.PlanAutoGenerated Plan { get { throw null; } set { } } + public Azure.Management.Resources.Models.ProvisioningState? ProvisioningState { get { throw null; } } + } + public partial class ApplicationArtifact + { + public ApplicationArtifact() { } + public string Name { get { throw null; } set { } } + public Azure.Management.Resources.Models.ApplicationArtifactType? Type { get { throw null; } set { } } + public string Uri { get { throw null; } set { } } + } + public enum ApplicationArtifactType + { + Template = 0, + Custom = 1, + } + public partial class ApplicationDefinition : Azure.Management.Resources.Models.GenericResourceAutoGenerated + { + public ApplicationDefinition(Azure.Management.Resources.Models.ApplicationLockLevel lockLevel, System.Collections.Generic.IEnumerable authorizations) { } + public System.Collections.Generic.IList Artifacts { get { throw null; } set { } } + public System.Collections.Generic.IList Authorizations { get { throw null; } set { } } + public object CreateUiDefinition { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public string IsEnabled { get { throw null; } set { } } + public Azure.Management.Resources.Models.ApplicationLockLevel LockLevel { get { throw null; } set { } } + public object MainTemplate { get { throw null; } set { } } + public string PackageFileUri { get { throw null; } set { } } + } + public partial class ApplicationDefinitionListResult + { + internal ApplicationDefinitionListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class ApplicationListResult + { + internal ApplicationListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public enum ApplicationLockLevel + { + CanNotDelete = 0, + ReadOnly = 1, + None = 2, + } + public partial class ApplicationPatchable : Azure.Management.Resources.Models.GenericResourceAutoGenerated + { + public ApplicationPatchable() { } + public string ApplicationDefinitionId { get { throw null; } set { } } + public string Kind { get { throw null; } set { } } + public string ManagedResourceGroupId { get { throw null; } set { } } + public object Outputs { get { throw null; } } + public object Parameters { get { throw null; } set { } } + public Azure.Management.Resources.Models.PlanPatchable Plan { get { throw null; } set { } } + public Azure.Management.Resources.Models.ProvisioningState? ProvisioningState { get { throw null; } } + } + public partial class ApplicationProviderAuthorization + { + public ApplicationProviderAuthorization(string principalId, string roleDefinitionId) { } + public string PrincipalId { get { throw null; } set { } } + public string RoleDefinitionId { get { throw null; } set { } } + } + public partial class AzureCliScript : Azure.Management.Resources.Models.DeploymentScript + { + public AzureCliScript(Azure.Management.Resources.Models.ManagedServiceIdentity identity, string location, System.TimeSpan retentionInterval, string azCliVersion) : base (default(Azure.Management.Resources.Models.ManagedServiceIdentity), default(string)) { } + public string Arguments { get { throw null; } set { } } + public string AzCliVersion { get { throw null; } set { } } + public Azure.Management.Resources.Models.CleanupOptions? CleanupPreference { get { throw null; } set { } } + public Azure.Management.Resources.Models.ContainerConfiguration ContainerSettings { get { throw null; } set { } } + public System.Collections.Generic.IList EnvironmentVariables { get { throw null; } set { } } + public string ForceUpdateTag { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Outputs { get { throw null; } } + public string PrimaryScriptUri { get { throw null; } set { } } + public Azure.Management.Resources.Models.ScriptProvisioningState? ProvisioningState { get { throw null; } } + public System.TimeSpan RetentionInterval { get { throw null; } set { } } + public string ScriptContent { get { throw null; } set { } } + public Azure.Management.Resources.Models.ScriptStatus Status { get { throw null; } } + public Azure.Management.Resources.Models.StorageAccountConfiguration StorageAccountSettings { get { throw null; } set { } } + public System.Collections.Generic.IList SupportingScriptUris { get { throw null; } set { } } + public System.TimeSpan? Timeout { get { throw null; } set { } } + } + public partial class AzureCliScriptProperties : Azure.Management.Resources.Models.DeploymentScriptPropertiesBase + { + public AzureCliScriptProperties(string azCliVersion, System.TimeSpan retentionInterval) { } + public string Arguments { get { throw null; } set { } } + public string AzCliVersion { get { throw null; } set { } } + public System.Collections.Generic.IList EnvironmentVariables { get { throw null; } set { } } + public string ForceUpdateTag { get { throw null; } set { } } + public string PrimaryScriptUri { get { throw null; } set { } } + public System.TimeSpan RetentionInterval { get { throw null; } set { } } + public string ScriptContent { get { throw null; } set { } } + public System.Collections.Generic.IList SupportingScriptUris { get { throw null; } set { } } + public System.TimeSpan? Timeout { get { throw null; } set { } } + } + public partial class AzurePowerShellScript : Azure.Management.Resources.Models.DeploymentScript + { + public AzurePowerShellScript(Azure.Management.Resources.Models.ManagedServiceIdentity identity, string location, System.TimeSpan retentionInterval, string azPowerShellVersion) : base (default(Azure.Management.Resources.Models.ManagedServiceIdentity), default(string)) { } + public string Arguments { get { throw null; } set { } } + public string AzPowerShellVersion { get { throw null; } set { } } + public Azure.Management.Resources.Models.CleanupOptions? CleanupPreference { get { throw null; } set { } } + public Azure.Management.Resources.Models.ContainerConfiguration ContainerSettings { get { throw null; } set { } } + public System.Collections.Generic.IList EnvironmentVariables { get { throw null; } set { } } + public string ForceUpdateTag { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Outputs { get { throw null; } } + public string PrimaryScriptUri { get { throw null; } set { } } + public Azure.Management.Resources.Models.ScriptProvisioningState? ProvisioningState { get { throw null; } } + public System.TimeSpan RetentionInterval { get { throw null; } set { } } + public string ScriptContent { get { throw null; } set { } } + public Azure.Management.Resources.Models.ScriptStatus Status { get { throw null; } } + public Azure.Management.Resources.Models.StorageAccountConfiguration StorageAccountSettings { get { throw null; } set { } } + public System.Collections.Generic.IList SupportingScriptUris { get { throw null; } set { } } + public System.TimeSpan? Timeout { get { throw null; } set { } } + } + public partial class AzurePowerShellScriptProperties : Azure.Management.Resources.Models.DeploymentScriptPropertiesBase + { + public AzurePowerShellScriptProperties(string azPowerShellVersion, System.TimeSpan retentionInterval) { } + public string Arguments { get { throw null; } set { } } + public string AzPowerShellVersion { get { throw null; } set { } } + public System.Collections.Generic.IList EnvironmentVariables { get { throw null; } set { } } + public string ForceUpdateTag { get { throw null; } set { } } + public string PrimaryScriptUri { get { throw null; } set { } } + public System.TimeSpan RetentionInterval { get { throw null; } set { } } + public string ScriptContent { get { throw null; } set { } } + public System.Collections.Generic.IList SupportingScriptUris { get { throw null; } set { } } + public System.TimeSpan? Timeout { get { throw null; } set { } } + } + public partial class AzureResourceBase + { + public AzureResourceBase() { } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + public string Type { get { throw null; } } + } + public partial class BasicDependency + { + internal BasicDependency() { } + public string Id { get { throw null; } } + public string ResourceName { get { throw null; } } + public string ResourceType { get { throw null; } } + } + public enum ChangeType + { + Create = 0, + Delete = 1, + Ignore = 2, + Deploy = 3, + NoChange = 4, + Modify = 5, + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CleanupOptions : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CleanupOptions(string value) { throw null; } + public static Azure.Management.Resources.Models.CleanupOptions Always { get { throw null; } } + public static Azure.Management.Resources.Models.CleanupOptions OnExpiration { get { throw null; } } + public static Azure.Management.Resources.Models.CleanupOptions OnSuccess { get { throw null; } } + public bool Equals(Azure.Management.Resources.Models.CleanupOptions other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Management.Resources.Models.CleanupOptions left, Azure.Management.Resources.Models.CleanupOptions right) { throw null; } + public static implicit operator Azure.Management.Resources.Models.CleanupOptions (string value) { throw null; } + public static bool operator !=(Azure.Management.Resources.Models.CleanupOptions left, Azure.Management.Resources.Models.CleanupOptions right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CloudError + { + internal CloudError() { } + public Azure.Management.Resources.Models.ErrorResponse Error { get { throw null; } } + } + public partial class ContainerConfiguration + { + public ContainerConfiguration() { } + public string ContainerGroupName { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CreatedByType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CreatedByType(string value) { throw null; } + public static Azure.Management.Resources.Models.CreatedByType Application { get { throw null; } } + public static Azure.Management.Resources.Models.CreatedByType Key { get { throw null; } } + public static Azure.Management.Resources.Models.CreatedByType ManagedIdentity { get { throw null; } } + public static Azure.Management.Resources.Models.CreatedByType User { get { throw null; } } + public bool Equals(Azure.Management.Resources.Models.CreatedByType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Management.Resources.Models.CreatedByType left, Azure.Management.Resources.Models.CreatedByType right) { throw null; } + public static implicit operator Azure.Management.Resources.Models.CreatedByType (string value) { throw null; } + public static bool operator !=(Azure.Management.Resources.Models.CreatedByType left, Azure.Management.Resources.Models.CreatedByType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DebugSetting + { + public DebugSetting() { } + public string DetailLevel { get { throw null; } set { } } + } + public partial class Dependency + { + internal Dependency() { } + public System.Collections.Generic.IReadOnlyList DependsOn { get { throw null; } } + public string Id { get { throw null; } } + public string ResourceName { get { throw null; } } + public string ResourceType { get { throw null; } } + } + public partial class Deployment + { + public Deployment(Azure.Management.Resources.Models.DeploymentProperties properties) { } + public string Location { get { throw null; } set { } } + public Azure.Management.Resources.Models.DeploymentProperties Properties { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } set { } } + } + public partial class DeploymentExportResult + { + internal DeploymentExportResult() { } + public object Template { get { throw null; } } + } + public partial class DeploymentExtended + { + internal DeploymentExtended() { } + public string Id { get { throw null; } } + public string Location { get { throw null; } } + public string Name { get { throw null; } } + public Azure.Management.Resources.Models.DeploymentPropertiesExtended Properties { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Tags { get { throw null; } } + public string Type { get { throw null; } } + } + public partial class DeploymentListResult + { + internal DeploymentListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public enum DeploymentMode + { + Incremental = 0, + Complete = 1, + } + public partial class DeploymentOperation + { + internal DeploymentOperation() { } + public string Id { get { throw null; } } + public string OperationId { get { throw null; } } + public Azure.Management.Resources.Models.DeploymentOperationProperties Properties { get { throw null; } } + } + public partial class DeploymentOperationProperties + { + internal DeploymentOperationProperties() { } + public string Duration { get { throw null; } } + public Azure.Management.Resources.Models.ProvisioningOperation? ProvisioningOperation { get { throw null; } } + public string ProvisioningState { get { throw null; } } + public Azure.Management.Resources.Models.HttpMessage Request { get { throw null; } } + public Azure.Management.Resources.Models.HttpMessage Response { get { throw null; } } + public string ServiceRequestId { get { throw null; } } + public string StatusCode { get { throw null; } } + public object StatusMessage { get { throw null; } } + public Azure.Management.Resources.Models.TargetResource TargetResource { get { throw null; } } + public System.DateTimeOffset? Timestamp { get { throw null; } } + } + public partial class DeploymentOperationsListResult + { + internal DeploymentOperationsListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class DeploymentProperties + { + public DeploymentProperties(Azure.Management.Resources.Models.DeploymentMode mode) { } + public Azure.Management.Resources.Models.DebugSetting DebugSetting { get { throw null; } set { } } + public Azure.Management.Resources.Models.DeploymentMode Mode { get { throw null; } } + public Azure.Management.Resources.Models.OnErrorDeployment OnErrorDeployment { get { throw null; } set { } } + public object Parameters { get { throw null; } set { } } + public Azure.Management.Resources.Models.ParametersLink ParametersLink { get { throw null; } set { } } + public object Template { get { throw null; } set { } } + public Azure.Management.Resources.Models.TemplateLink TemplateLink { get { throw null; } set { } } + } + public partial class DeploymentPropertiesExtended + { + internal DeploymentPropertiesExtended() { } + public string CorrelationId { get { throw null; } } + public Azure.Management.Resources.Models.DebugSetting DebugSetting { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Dependencies { get { throw null; } } + public string Duration { get { throw null; } } + public Azure.Management.Resources.Models.ErrorResponse Error { get { throw null; } } + public Azure.Management.Resources.Models.DeploymentMode? Mode { get { throw null; } } + public Azure.Management.Resources.Models.OnErrorDeploymentExtended OnErrorDeployment { get { throw null; } } + public System.Collections.Generic.IReadOnlyList OutputResources { get { throw null; } } + public object Outputs { get { throw null; } } + public object Parameters { get { throw null; } } + public Azure.Management.Resources.Models.ParametersLink ParametersLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Providers { get { throw null; } } + public string ProvisioningState { get { throw null; } } + public string TemplateHash { get { throw null; } } + public Azure.Management.Resources.Models.TemplateLink TemplateLink { get { throw null; } } + public System.DateTimeOffset? Timestamp { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ValidatedResources { get { throw null; } } + } + public partial class DeploymentScript : Azure.Management.Resources.Models.AzureResourceBase + { + public DeploymentScript(Azure.Management.Resources.Models.ManagedServiceIdentity identity, string location) { } + public Azure.Management.Resources.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public string Location { get { throw null; } set { } } + public Azure.Management.Resources.Models.SystemData SystemData { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } set { } } + } + public partial class DeploymentScriptListResult + { + internal DeploymentScriptListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class DeploymentScriptPropertiesBase + { + public DeploymentScriptPropertiesBase() { } + public Azure.Management.Resources.Models.CleanupOptions? CleanupPreference { get { throw null; } set { } } + public Azure.Management.Resources.Models.ContainerConfiguration ContainerSettings { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Outputs { get { throw null; } } + public Azure.Management.Resources.Models.ScriptProvisioningState? ProvisioningState { get { throw null; } } + public Azure.Management.Resources.Models.ScriptStatus Status { get { throw null; } } + public Azure.Management.Resources.Models.StorageAccountConfiguration StorageAccountSettings { get { throw null; } set { } } + } + public partial class DeploymentScriptsError + { + internal DeploymentScriptsError() { } + public Azure.Management.Resources.Models.ErrorResponse Error { get { throw null; } } + } + public partial class DeploymentScriptUpdateParameter : Azure.Management.Resources.Models.AzureResourceBase + { + public DeploymentScriptUpdateParameter() { } + public System.Collections.Generic.IDictionary Tags { get { throw null; } set { } } + } + public partial class DeploymentValidateResult + { + internal DeploymentValidateResult() { } + public Azure.Management.Resources.Models.ErrorResponse Error { get { throw null; } } + public Azure.Management.Resources.Models.DeploymentPropertiesExtended Properties { get { throw null; } } + } + public partial class DeploymentWhatIf + { + public DeploymentWhatIf(Azure.Management.Resources.Models.DeploymentWhatIfProperties properties) { } + public string Location { get { throw null; } set { } } + public Azure.Management.Resources.Models.DeploymentWhatIfProperties Properties { get { throw null; } } + } + public partial class DeploymentWhatIfProperties : Azure.Management.Resources.Models.DeploymentProperties + { + public DeploymentWhatIfProperties(Azure.Management.Resources.Models.DeploymentMode mode) : base (default(Azure.Management.Resources.Models.DeploymentMode)) { } + public Azure.Management.Resources.Models.DeploymentWhatIfSettings WhatIfSettings { get { throw null; } set { } } + } + public partial class DeploymentWhatIfSettings + { + public DeploymentWhatIfSettings() { } + public Azure.Management.Resources.Models.WhatIfResultFormat? ResultFormat { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EnforcementMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EnforcementMode(string value) { throw null; } + public static Azure.Management.Resources.Models.EnforcementMode Default { get { throw null; } } + public static Azure.Management.Resources.Models.EnforcementMode DoNotEnforce { get { throw null; } } + public bool Equals(Azure.Management.Resources.Models.EnforcementMode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Management.Resources.Models.EnforcementMode left, Azure.Management.Resources.Models.EnforcementMode right) { throw null; } + public static implicit operator Azure.Management.Resources.Models.EnforcementMode (string value) { throw null; } + public static bool operator !=(Azure.Management.Resources.Models.EnforcementMode left, Azure.Management.Resources.Models.EnforcementMode right) { throw null; } + public override string ToString() { throw null; } + } + public partial class EnvironmentVariable + { + public EnvironmentVariable(string name) { } + public string Name { get { throw null; } set { } } + public string SecureValue { get { throw null; } set { } } + public string Value { get { throw null; } set { } } + } + public partial class ErrorAdditionalInfo + { + public ErrorAdditionalInfo() { } + public object Info { get { throw null; } } + public string Type { get { throw null; } } + } + public partial class ErrorResponse + { + public ErrorResponse() { } + public System.Collections.Generic.IList AdditionalInfo { get { throw null; } } + public string Code { get { throw null; } } + public System.Collections.Generic.IList Details { get { throw null; } } + public string Message { get { throw null; } } + public string Target { get { throw null; } } + } + public partial class ErrorResponseAutoGenerated + { + internal ErrorResponseAutoGenerated() { } + public string ErrorCode { get { throw null; } } + public string ErrorMessage { get { throw null; } } + public string HttpStatus { get { throw null; } } + } + public partial class ExportTemplateRequest + { + public ExportTemplateRequest() { } + public string Options { get { throw null; } set { } } + public System.Collections.Generic.IList Resources { get { throw null; } set { } } + } + public partial class FeatureOperationsListResult + { + internal FeatureOperationsListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class FeatureProperties + { + internal FeatureProperties() { } + public string State { get { throw null; } } + } + public partial class FeatureResult + { + internal FeatureResult() { } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + public Azure.Management.Resources.Models.FeatureProperties Properties { get { throw null; } } + public string Type { get { throw null; } } + } + public partial class GenericResource : Azure.Management.Resources.Models.Resource + { + public GenericResource() { } + public Azure.Management.Resources.Models.Identity Identity { get { throw null; } set { } } + public string Kind { get { throw null; } set { } } + public string ManagedBy { get { throw null; } set { } } + public Azure.Management.Resources.Models.Plan Plan { get { throw null; } set { } } + public object Properties { get { throw null; } set { } } + public Azure.Management.Resources.Models.Sku Sku { get { throw null; } set { } } + } + public partial class GenericResourceAutoGenerated : Azure.Management.Resources.Models.Resource + { + public GenericResourceAutoGenerated() { } + public Azure.Management.Resources.Models.IdentityAutoGenerated2 Identity { get { throw null; } set { } } + public string ManagedBy { get { throw null; } set { } } + public Azure.Management.Resources.Models.SkuAutoGenerated Sku { get { throw null; } set { } } + } + public partial class GenericResourceExpanded : Azure.Management.Resources.Models.GenericResource + { + public GenericResourceExpanded() { } + public System.DateTimeOffset? ChangedTime { get { throw null; } } + public System.DateTimeOffset? CreatedTime { get { throw null; } } + public string ProvisioningState { get { throw null; } } + } + public partial class HttpMessage + { + internal HttpMessage() { } + public object Content { get { throw null; } } + } + public partial class Identity + { + public Identity() { } + public string PrincipalId { get { throw null; } } + public string TenantId { get { throw null; } } + public Azure.Management.Resources.Models.ResourceIdentityType? Type { get { throw null; } set { } } + public System.Collections.Generic.IDictionary UserAssignedIdentities { get { throw null; } set { } } + } + public partial class IdentityAutoGenerated + { + public IdentityAutoGenerated() { } + public string PrincipalId { get { throw null; } } + public string TenantId { get { throw null; } } + public Azure.Management.Resources.Models.ResourceIdentityType? Type { get { throw null; } set { } } + } + public partial class IdentityAutoGenerated2 + { + public IdentityAutoGenerated2() { } + public string PrincipalId { get { throw null; } } + public string TenantId { get { throw null; } } + public Azure.Management.Resources.Models.ResourceIdentityType? Type { get { throw null; } set { } } + } + public partial class IdentityUserAssignedIdentitiesValue + { + public IdentityUserAssignedIdentitiesValue() { } + public string ClientId { get { throw null; } } + public string PrincipalId { get { throw null; } } + } + public partial class Location + { + internal Location() { } + public string DisplayName { get { throw null; } } + public string Id { get { throw null; } } + public Azure.Management.Resources.Models.LocationMetadata Metadata { get { throw null; } } + public string Name { get { throw null; } } + public string RegionalDisplayName { get { throw null; } } + public string SubscriptionId { get { throw null; } } + } + public partial class LocationListResult + { + internal LocationListResult() { } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class LocationMetadata + { + internal LocationMetadata() { } + public string GeographyGroup { get { throw null; } } + public string Latitude { get { throw null; } } + public string Longitude { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PairedRegion { get { throw null; } } + public string PhysicalLocation { get { throw null; } } + public Azure.Management.Resources.Models.RegionCategory? RegionCategory { get { throw null; } } + public Azure.Management.Resources.Models.RegionType? RegionType { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct LockLevel : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public LockLevel(string value) { throw null; } + public static Azure.Management.Resources.Models.LockLevel CanNotDelete { get { throw null; } } + public static Azure.Management.Resources.Models.LockLevel NotSpecified { get { throw null; } } + public static Azure.Management.Resources.Models.LockLevel ReadOnly { get { throw null; } } + public bool Equals(Azure.Management.Resources.Models.LockLevel other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Management.Resources.Models.LockLevel left, Azure.Management.Resources.Models.LockLevel right) { throw null; } + public static implicit operator Azure.Management.Resources.Models.LockLevel (string value) { throw null; } + public static bool operator !=(Azure.Management.Resources.Models.LockLevel left, Azure.Management.Resources.Models.LockLevel right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ManagedByTenant + { + internal ManagedByTenant() { } + public string TenantId { get { throw null; } } + } + public partial class ManagedServiceIdentity + { + public ManagedServiceIdentity() { } + public string Type { get { throw null; } set { } } + public System.Collections.Generic.IDictionary UserAssignedIdentities { get { throw null; } set { } } + } + public partial class ManagementLockListResult + { + internal ManagementLockListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class ManagementLockObject + { + public ManagementLockObject(Azure.Management.Resources.Models.LockLevel level) { } + public string Id { get { throw null; } } + public Azure.Management.Resources.Models.LockLevel Level { get { throw null; } set { } } + public string Name { get { throw null; } } + public string Notes { get { throw null; } set { } } + public System.Collections.Generic.IList Owners { get { throw null; } set { } } + public string Type { get { throw null; } } + } + public partial class ManagementLockOwner + { + public ManagementLockOwner() { } + public string ApplicationId { get { throw null; } set { } } + } + public partial class OnErrorDeployment + { + public OnErrorDeployment() { } + public string DeploymentName { get { throw null; } set { } } + public Azure.Management.Resources.Models.OnErrorDeploymentType? Type { get { throw null; } set { } } + } + public partial class OnErrorDeploymentExtended + { + internal OnErrorDeploymentExtended() { } + public string DeploymentName { get { throw null; } } + public string ProvisioningState { get { throw null; } } + public Azure.Management.Resources.Models.OnErrorDeploymentType? Type { get { throw null; } } + } + public enum OnErrorDeploymentType + { + LastSuccessful = 0, + SpecificDeployment = 1, + } + public partial class Operation + { + internal Operation() { } + public Azure.Management.Resources.Models.OperationDisplay Display { get { throw null; } } + public string Name { get { throw null; } } + } + public partial class OperationAutoGenerated + { + internal OperationAutoGenerated() { } + public Azure.Management.Resources.Models.OperationDisplayAutoGenerated Display { get { throw null; } } + public string Name { get { throw null; } } + } + public partial class OperationAutoGenerated2 + { + internal OperationAutoGenerated2() { } + public Azure.Management.Resources.Models.OperationDisplayAutoGenerated2 Display { get { throw null; } } + public string Name { get { throw null; } } + } + public partial class OperationDisplay + { + internal OperationDisplay() { } + public string Description { get { throw null; } } + public string Operation { get { throw null; } } + public string Provider { get { throw null; } } + public string Resource { get { throw null; } } + } + public partial class OperationDisplayAutoGenerated + { + internal OperationDisplayAutoGenerated() { } + public string Operation { get { throw null; } } + public string Provider { get { throw null; } } + public string Resource { get { throw null; } } + } + public partial class OperationDisplayAutoGenerated2 + { + internal OperationDisplayAutoGenerated2() { } + public string Operation { get { throw null; } } + public string Provider { get { throw null; } } + public string Resource { get { throw null; } } + } + public partial class OperationListResult + { + internal OperationListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class OperationListResultAutoGenerated + { + internal OperationListResultAutoGenerated() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class OperationListResultAutoGenerated2 + { + internal OperationListResultAutoGenerated2() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class PairedRegion + { + internal PairedRegion() { } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + public string SubscriptionId { get { throw null; } } + } + public partial class ParameterDefinitionsValue + { + public ParameterDefinitionsValue() { } + public System.Collections.Generic.IList AllowedValues { get { throw null; } set { } } + public object DefaultValue { get { throw null; } set { } } + public Azure.Management.Resources.Models.ParameterDefinitionsValueMetadata Metadata { get { throw null; } set { } } + public Azure.Management.Resources.Models.ParameterType? Type { get { throw null; } set { } } + } + public partial class ParameterDefinitionsValueMetadata : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable + { + public ParameterDefinitionsValueMetadata() { } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public object this[string key] { get { throw null; } set { } } + public System.Collections.Generic.ICollection Keys { get { throw null; } } + int System.Collections.Generic.ICollection>.Count { get { throw null; } } + bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } + public System.Collections.Generic.ICollection Values { get { throw null; } } + public void Add(string key, object value) { } + public bool ContainsKey(string key) { throw null; } + public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } + public bool Remove(string key) { throw null; } + void System.Collections.Generic.ICollection>.Add(System.Collections.Generic.KeyValuePair value) { } + void System.Collections.Generic.ICollection>.Clear() { } + bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair value) { throw null; } + void System.Collections.Generic.ICollection>.CopyTo(System.Collections.Generic.KeyValuePair[] destination, int offset) { } + bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair value) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public bool TryGetValue(string key, out object value) { throw null; } + } + public partial class ParametersLink + { + public ParametersLink(string uri) { } + public string ContentVersion { get { throw null; } set { } } + public string Uri { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ParameterType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ParameterType(string value) { throw null; } + public static Azure.Management.Resources.Models.ParameterType Array { get { throw null; } } + public static Azure.Management.Resources.Models.ParameterType Boolean { get { throw null; } } + public static Azure.Management.Resources.Models.ParameterType DateTime { get { throw null; } } + public static Azure.Management.Resources.Models.ParameterType Float { get { throw null; } } + public static Azure.Management.Resources.Models.ParameterType Integer { get { throw null; } } + public static Azure.Management.Resources.Models.ParameterType Object { get { throw null; } } + public static Azure.Management.Resources.Models.ParameterType String { get { throw null; } } + public bool Equals(Azure.Management.Resources.Models.ParameterType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Management.Resources.Models.ParameterType left, Azure.Management.Resources.Models.ParameterType right) { throw null; } + public static implicit operator Azure.Management.Resources.Models.ParameterType (string value) { throw null; } + public static bool operator !=(Azure.Management.Resources.Models.ParameterType left, Azure.Management.Resources.Models.ParameterType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ParameterValuesValue + { + public ParameterValuesValue() { } + public object Value { get { throw null; } set { } } + } + public partial class Plan + { + public Plan() { } + public string Name { get { throw null; } set { } } + public string Product { get { throw null; } set { } } + public string PromotionCode { get { throw null; } set { } } + public string Publisher { get { throw null; } set { } } + public string Version { get { throw null; } set { } } + } + public partial class PlanAutoGenerated + { + public PlanAutoGenerated(string name, string publisher, string product, string version) { } + public string Name { get { throw null; } set { } } + public string Product { get { throw null; } set { } } + public string PromotionCode { get { throw null; } set { } } + public string Publisher { get { throw null; } set { } } + public string Version { get { throw null; } set { } } + } + public partial class PlanPatchable + { + public PlanPatchable() { } + public string Name { get { throw null; } set { } } + public string Product { get { throw null; } set { } } + public string PromotionCode { get { throw null; } set { } } + public string Publisher { get { throw null; } set { } } + public string Version { get { throw null; } set { } } + } + public partial class PolicyAssignment + { + public PolicyAssignment() { } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public Azure.Management.Resources.Models.EnforcementMode? EnforcementMode { get { throw null; } set { } } + public string Id { get { throw null; } } + public Azure.Management.Resources.Models.IdentityAutoGenerated Identity { get { throw null; } set { } } + public string Location { get { throw null; } set { } } + public object Metadata { get { throw null; } set { } } + public string Name { get { throw null; } } + public System.Collections.Generic.IList NotScopes { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Parameters { get { throw null; } set { } } + public string PolicyDefinitionId { get { throw null; } set { } } + public string Scope { get { throw null; } set { } } + public Azure.Management.Resources.Models.PolicySku Sku { get { throw null; } set { } } + public string Type { get { throw null; } } + } + public partial class PolicyAssignmentListResult + { + internal PolicyAssignmentListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class PolicyDefinition + { + public PolicyDefinition() { } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public string Id { get { throw null; } } + public object Metadata { get { throw null; } set { } } + public string Mode { get { throw null; } set { } } + public string Name { get { throw null; } } + public System.Collections.Generic.IDictionary Parameters { get { throw null; } set { } } + public object PolicyRule { get { throw null; } set { } } + public Azure.Management.Resources.Models.PolicyType? PolicyType { get { throw null; } set { } } + public string Type { get { throw null; } } + } + public partial class PolicyDefinitionGroup + { + public PolicyDefinitionGroup(string name) { } + public string AdditionalMetadataId { get { throw null; } set { } } + public string Category { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + } + public partial class PolicyDefinitionListResult + { + internal PolicyDefinitionListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class PolicyDefinitionReference + { + public PolicyDefinitionReference(string policyDefinitionId) { } + public System.Collections.Generic.IList GroupNames { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Parameters { get { throw null; } set { } } + public string PolicyDefinitionId { get { throw null; } set { } } + public string PolicyDefinitionReferenceId { get { throw null; } set { } } + } + public partial class PolicySetDefinition + { + public PolicySetDefinition() { } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public string Id { get { throw null; } } + public object Metadata { get { throw null; } set { } } + public string Name { get { throw null; } } + public System.Collections.Generic.IDictionary Parameters { get { throw null; } set { } } + public System.Collections.Generic.IList PolicyDefinitionGroups { get { throw null; } set { } } + public System.Collections.Generic.IList PolicyDefinitions { get { throw null; } set { } } + public Azure.Management.Resources.Models.PolicyType? PolicyType { get { throw null; } set { } } + public string Type { get { throw null; } } + } + public partial class PolicySetDefinitionListResult + { + internal PolicySetDefinitionListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class PolicySku + { + public PolicySku(string name) { } + public string Name { get { throw null; } set { } } + public string Tier { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PolicyType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PolicyType(string value) { throw null; } + public static Azure.Management.Resources.Models.PolicyType BuiltIn { get { throw null; } } + public static Azure.Management.Resources.Models.PolicyType Custom { get { throw null; } } + public static Azure.Management.Resources.Models.PolicyType NotSpecified { get { throw null; } } + public static Azure.Management.Resources.Models.PolicyType Static { get { throw null; } } + public bool Equals(Azure.Management.Resources.Models.PolicyType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Management.Resources.Models.PolicyType left, Azure.Management.Resources.Models.PolicyType right) { throw null; } + public static implicit operator Azure.Management.Resources.Models.PolicyType (string value) { throw null; } + public static bool operator !=(Azure.Management.Resources.Models.PolicyType left, Azure.Management.Resources.Models.PolicyType right) { throw null; } + public override string ToString() { throw null; } + } + public enum PropertyChangeType + { + Create = 0, + Delete = 1, + Modify = 2, + Array = 3, + } + public partial class Provider + { + internal Provider() { } + public string Id { get { throw null; } } + public string Namespace { get { throw null; } } + public string RegistrationPolicy { get { throw null; } } + public string RegistrationState { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ResourceTypes { get { throw null; } } + } + public partial class ProviderListResult + { + internal ProviderListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class ProviderResourceType + { + internal ProviderResourceType() { } + public System.Collections.Generic.IReadOnlyList Aliases { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ApiVersions { get { throw null; } } + public string Capabilities { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Locations { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Properties { get { throw null; } } + public string ResourceType { get { throw null; } } + } + public enum ProvisioningOperation + { + NotSpecified = 0, + Create = 1, + Delete = 2, + Waiting = 3, + AzureAsyncOperationWaiting = 4, + ResourceCacheWaiting = 5, + Action = 6, + Read = 7, + EvaluateDeploymentOutput = 8, + DeploymentCleanup = 9, + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.Management.Resources.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.Management.Resources.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.Management.Resources.Models.ProvisioningState Created { get { throw null; } } + public static Azure.Management.Resources.Models.ProvisioningState Creating { get { throw null; } } + public static Azure.Management.Resources.Models.ProvisioningState Deleted { get { throw null; } } + public static Azure.Management.Resources.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.Management.Resources.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.Management.Resources.Models.ProvisioningState Ready { get { throw null; } } + public static Azure.Management.Resources.Models.ProvisioningState Running { get { throw null; } } + public static Azure.Management.Resources.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.Management.Resources.Models.ProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.Management.Resources.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Management.Resources.Models.ProvisioningState left, Azure.Management.Resources.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.Management.Resources.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.Management.Resources.Models.ProvisioningState left, Azure.Management.Resources.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RegionCategory : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RegionCategory(string value) { throw null; } + public static Azure.Management.Resources.Models.RegionCategory Other { get { throw null; } } + public static Azure.Management.Resources.Models.RegionCategory Recommended { get { throw null; } } + public bool Equals(Azure.Management.Resources.Models.RegionCategory other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Management.Resources.Models.RegionCategory left, Azure.Management.Resources.Models.RegionCategory right) { throw null; } + public static implicit operator Azure.Management.Resources.Models.RegionCategory (string value) { throw null; } + public static bool operator !=(Azure.Management.Resources.Models.RegionCategory left, Azure.Management.Resources.Models.RegionCategory right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RegionType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RegionType(string value) { throw null; } + public static Azure.Management.Resources.Models.RegionType Logical { get { throw null; } } + public static Azure.Management.Resources.Models.RegionType Physical { get { throw null; } } + public bool Equals(Azure.Management.Resources.Models.RegionType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Management.Resources.Models.RegionType left, Azure.Management.Resources.Models.RegionType right) { throw null; } + public static implicit operator Azure.Management.Resources.Models.RegionType (string value) { throw null; } + public static bool operator !=(Azure.Management.Resources.Models.RegionType left, Azure.Management.Resources.Models.RegionType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Resource + { + public Resource() { } + public string Id { get { throw null; } } + public string Location { get { throw null; } set { } } + public string Name { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } set { } } + public string Type { get { throw null; } } + } + public partial class ResourceGroup + { + public ResourceGroup(string location) { } + public string Id { get { throw null; } } + public string Location { get { throw null; } set { } } + public string ManagedBy { get { throw null; } set { } } + public string Name { get { throw null; } } + public Azure.Management.Resources.Models.ResourceGroupProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } set { } } + public string Type { get { throw null; } } + } + public partial class ResourceGroupExportResult + { + internal ResourceGroupExportResult() { } + public Azure.Management.Resources.Models.ErrorResponse Error { get { throw null; } } + public object Template { get { throw null; } } + } + public partial class ResourceGroupListResult + { + internal ResourceGroupListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class ResourceGroupPatchable + { + public ResourceGroupPatchable() { } + public string ManagedBy { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.Management.Resources.Models.ResourceGroupProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } set { } } + } + public partial class ResourceGroupProperties + { + public ResourceGroupProperties() { } + public string ProvisioningState { get { throw null; } } + } + public enum ResourceIdentityType + { + SystemAssigned = 0, + None = 1, + UserAssigned = 2, + SystemAssignedUserAssigned = 3, + } + public partial class ResourceLink + { + public ResourceLink() { } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + public Azure.Management.Resources.Models.ResourceLinkProperties Properties { get { throw null; } set { } } + public object Type { get { throw null; } } + } + public partial class ResourceLinkProperties + { + public ResourceLinkProperties(string targetId) { } + public string Notes { get { throw null; } set { } } + public string SourceId { get { throw null; } } + public string TargetId { get { throw null; } set { } } + } + public partial class ResourceLinkResult + { + internal ResourceLinkResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class ResourceListResult + { + internal ResourceListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class ResourceReference + { + internal ResourceReference() { } + public string Id { get { throw null; } } + } + public partial class ResourcesMoveInfo + { + public ResourcesMoveInfo() { } + public System.Collections.Generic.IList Resources { get { throw null; } set { } } + public string TargetResourceGroup { get { throw null; } set { } } + } + public partial class ScopedDeployment + { + public ScopedDeployment(string location, Azure.Management.Resources.Models.DeploymentProperties properties) { } + public string Location { get { throw null; } } + public Azure.Management.Resources.Models.DeploymentProperties Properties { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } set { } } + } + public partial class ScriptConfigurationBase + { + public ScriptConfigurationBase(System.TimeSpan retentionInterval) { } + public string Arguments { get { throw null; } set { } } + public System.Collections.Generic.IList EnvironmentVariables { get { throw null; } set { } } + public string ForceUpdateTag { get { throw null; } set { } } + public string PrimaryScriptUri { get { throw null; } set { } } + public System.TimeSpan RetentionInterval { get { throw null; } set { } } + public string ScriptContent { get { throw null; } set { } } + public System.Collections.Generic.IList SupportingScriptUris { get { throw null; } set { } } + public System.TimeSpan? Timeout { get { throw null; } set { } } + } + public partial class ScriptLog : Azure.Management.Resources.Models.AzureResourceBase + { + public ScriptLog() { } + public string Log { get { throw null; } } + } + public partial class ScriptLogsList + { + internal ScriptLogsList() { } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ScriptProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ScriptProvisioningState(string value) { throw null; } + public static Azure.Management.Resources.Models.ScriptProvisioningState Canceled { get { throw null; } } + public static Azure.Management.Resources.Models.ScriptProvisioningState Creating { get { throw null; } } + public static Azure.Management.Resources.Models.ScriptProvisioningState Failed { get { throw null; } } + public static Azure.Management.Resources.Models.ScriptProvisioningState ProvisioningResources { get { throw null; } } + public static Azure.Management.Resources.Models.ScriptProvisioningState Running { get { throw null; } } + public static Azure.Management.Resources.Models.ScriptProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.Management.Resources.Models.ScriptProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Management.Resources.Models.ScriptProvisioningState left, Azure.Management.Resources.Models.ScriptProvisioningState right) { throw null; } + public static implicit operator Azure.Management.Resources.Models.ScriptProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.Management.Resources.Models.ScriptProvisioningState left, Azure.Management.Resources.Models.ScriptProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ScriptStatus + { + public ScriptStatus() { } + public string ContainerInstanceId { get { throw null; } } + public System.DateTimeOffset? EndTime { get { throw null; } } + public Azure.Management.Resources.Models.ErrorResponse Error { get { throw null; } set { } } + public System.DateTimeOffset? ExpirationTime { get { throw null; } } + public System.DateTimeOffset? StartTime { get { throw null; } } + public string StorageAccountId { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ScriptType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ScriptType(string value) { throw null; } + public static Azure.Management.Resources.Models.ScriptType AzureCLI { get { throw null; } } + public static Azure.Management.Resources.Models.ScriptType AzurePowerShell { get { throw null; } } + public bool Equals(Azure.Management.Resources.Models.ScriptType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Management.Resources.Models.ScriptType left, Azure.Management.Resources.Models.ScriptType right) { throw null; } + public static implicit operator Azure.Management.Resources.Models.ScriptType (string value) { throw null; } + public static bool operator !=(Azure.Management.Resources.Models.ScriptType left, Azure.Management.Resources.Models.ScriptType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Sku + { + public Sku() { } + public int? Capacity { get { throw null; } set { } } + public string Family { get { throw null; } set { } } + public string Model { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public string Size { get { throw null; } set { } } + public string Tier { get { throw null; } set { } } + } + public partial class SkuAutoGenerated + { + public SkuAutoGenerated(string name) { } + public int? Capacity { get { throw null; } set { } } + public string Family { get { throw null; } set { } } + public string Model { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public string Size { get { throw null; } set { } } + public string Tier { get { throw null; } set { } } + } + public enum SpendingLimit + { + On = 0, + Off = 1, + CurrentPeriodOff = 2, + } + public partial class StorageAccountConfiguration + { + public StorageAccountConfiguration() { } + public string StorageAccountKey { get { throw null; } set { } } + public string StorageAccountName { get { throw null; } set { } } + } + public partial class Subscription + { + internal Subscription() { } + public string AuthorizationSource { get { throw null; } } + public string DisplayName { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ManagedByTenants { get { throw null; } } + public Azure.Management.Resources.Models.SubscriptionState? State { get { throw null; } } + public string SubscriptionId { get { throw null; } } + public Azure.Management.Resources.Models.SubscriptionPolicies SubscriptionPolicies { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Tags { get { throw null; } } + public string TenantId { get { throw null; } } + } + public partial class SubscriptionListResult + { + internal SubscriptionListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class SubscriptionPolicies + { + internal SubscriptionPolicies() { } + public string LocationPlacementId { get { throw null; } } + public string QuotaId { get { throw null; } } + public Azure.Management.Resources.Models.SpendingLimit? SpendingLimit { get { throw null; } } + } + public enum SubscriptionState + { + Enabled = 0, + Warned = 1, + PastDue = 2, + Disabled = 3, + Deleted = 4, + } + public partial class SystemData + { + public SystemData() { } + public System.DateTimeOffset? CreatedAt { get { throw null; } set { } } + public string CreatedBy { get { throw null; } set { } } + public Azure.Management.Resources.Models.CreatedByType? CreatedByType { get { throw null; } set { } } + public System.DateTimeOffset? LastModifiedAt { get { throw null; } set { } } + public string LastModifiedBy { get { throw null; } set { } } + public Azure.Management.Resources.Models.CreatedByType? LastModifiedByType { get { throw null; } set { } } + } + public partial class TagCount + { + internal TagCount() { } + public string Type { get { throw null; } } + public int? Value { get { throw null; } } + } + public partial class TagDetails + { + internal TagDetails() { } + public Azure.Management.Resources.Models.TagCount Count { get { throw null; } } + public string Id { get { throw null; } } + public string TagName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Values { get { throw null; } } + } + public partial class Tags + { + public Tags() { } + public System.Collections.Generic.IDictionary TagsValue { get { throw null; } set { } } + } + public partial class TagsListResult + { + internal TagsListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class TagsPatchResource + { + public TagsPatchResource() { } + public Azure.Management.Resources.Models.TagsPatchResourceOperation? Operation { get { throw null; } set { } } + public Azure.Management.Resources.Models.Tags Properties { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TagsPatchResourceOperation : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TagsPatchResourceOperation(string value) { throw null; } + public static Azure.Management.Resources.Models.TagsPatchResourceOperation Delete { get { throw null; } } + public static Azure.Management.Resources.Models.TagsPatchResourceOperation Merge { get { throw null; } } + public static Azure.Management.Resources.Models.TagsPatchResourceOperation Replace { get { throw null; } } + public bool Equals(Azure.Management.Resources.Models.TagsPatchResourceOperation other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Management.Resources.Models.TagsPatchResourceOperation left, Azure.Management.Resources.Models.TagsPatchResourceOperation right) { throw null; } + public static implicit operator Azure.Management.Resources.Models.TagsPatchResourceOperation (string value) { throw null; } + public static bool operator !=(Azure.Management.Resources.Models.TagsPatchResourceOperation left, Azure.Management.Resources.Models.TagsPatchResourceOperation right) { throw null; } + public override string ToString() { throw null; } + } + public partial class TagsResource + { + public TagsResource(Azure.Management.Resources.Models.Tags properties) { } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + public Azure.Management.Resources.Models.Tags Properties { get { throw null; } set { } } + public string Type { get { throw null; } } + } + public partial class TagValue + { + internal TagValue() { } + public Azure.Management.Resources.Models.TagCount Count { get { throw null; } } + public string Id { get { throw null; } } + public string TagValueValue { get { throw null; } } + } + public partial class TargetResource + { + internal TargetResource() { } + public string Id { get { throw null; } } + public string ResourceName { get { throw null; } } + public string ResourceType { get { throw null; } } + } + public partial class TemplateHashResult + { + internal TemplateHashResult() { } + public string MinifiedTemplate { get { throw null; } } + public string TemplateHash { get { throw null; } } + } + public partial class TemplateLink + { + public TemplateLink(string uri) { } + public string ContentVersion { get { throw null; } set { } } + public string Uri { get { throw null; } set { } } + } + public enum TenantCategory + { + Home = 0, + ProjectedBy = 1, + ManagedBy = 2, + } + public partial class TenantIdDescription + { + internal TenantIdDescription() { } + public string Country { get { throw null; } } + public string CountryCode { get { throw null; } } + public string DisplayName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Domains { get { throw null; } } + public string Id { get { throw null; } } + public Azure.Management.Resources.Models.TenantCategory? TenantCategory { get { throw null; } } + public string TenantId { get { throw null; } } + } + public partial class TenantListResult + { + internal TenantListResult() { } + public string NextLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } + public partial class UserAssignedIdentity + { + public UserAssignedIdentity() { } + public string ClientId { get { throw null; } set { } } + public string PrincipalId { get { throw null; } set { } } + } + public partial class WhatIfChange + { + internal WhatIfChange() { } + public object After { get { throw null; } } + public object Before { get { throw null; } } + public Azure.Management.Resources.Models.ChangeType ChangeType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Delta { get { throw null; } } + public string ResourceId { get { throw null; } } + } + public partial class WhatIfOperationResult + { + internal WhatIfOperationResult() { } + public System.Collections.Generic.IReadOnlyList Changes { get { throw null; } } + public Azure.Management.Resources.Models.ErrorResponse Error { get { throw null; } } + public string Status { get { throw null; } } + } + public partial class WhatIfPropertyChange + { + internal WhatIfPropertyChange() { } + public object After { get { throw null; } } + public object Before { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Children { get { throw null; } } + public string Path { get { throw null; } } + public Azure.Management.Resources.Models.PropertyChangeType PropertyChangeType { get { throw null; } } + } + public enum WhatIfResultFormat + { + ResourceIdOnly = 0, + FullResourcePayloads = 1, + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Azure.Management.Resources.csproj b/sdk/resources/Azure.Management.Resources/src/Azure.Management.Resources.csproj index b566699381a1..1de8a5133397 100644 --- a/sdk/resources/Azure.Management.Resources/src/Azure.Management.Resources.csproj +++ b/sdk/resources/Azure.Management.Resources/src/Azure.Management.Resources.csproj @@ -2,12 +2,8 @@ 1.0.0-preview.1 Azure.Management.Resources - Azure management client SDK for Azure resource provider Microsoft.Resources - azure;management;resources - - - - - $(NoWarn);AZC0100;AZC0008;CS1591 + Azure management client SDK for Azure resource provider Microsoft.Resource + azure;management;resource + $(NoWarn);AZC0008 diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsClient.cs new file mode 100644 index 000000000000..a56079a5a75e --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsClient.cs @@ -0,0 +1,432 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The ApplicationDefinitions service client. + public partial class ApplicationDefinitionsClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ApplicationDefinitionsRestClient RestClient { get; } + /// Initializes a new instance of ApplicationDefinitionsClient for mocking. + protected ApplicationDefinitionsClient() + { + } + /// Initializes a new instance of ApplicationDefinitionsClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal ApplicationDefinitionsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ApplicationDefinitionsRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the managed application definition. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application definition. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string applicationDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, applicationDefinitionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the managed application definition. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application definition. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string applicationDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, applicationDefinitionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the managed application definition. + /// The fully qualified ID of the managed application definition, including the managed application name and the managed application definition resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. + /// The cancellation token to use. + public virtual async Task> GetByIdAsync(string applicationDefinitionId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.GetById"); + scope.Start(); + try + { + return await RestClient.GetByIdAsync(applicationDefinitionId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the managed application definition. + /// The fully qualified ID of the managed application definition, including the managed application name and the managed application definition resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. + /// The cancellation token to use. + public virtual Response GetById(string applicationDefinitionId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.GetById"); + scope.Start(); + try + { + return RestClient.GetById(applicationDefinitionId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the managed application definitions in a resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, 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("ApplicationDefinitionsClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, 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); + } + + /// Lists the managed application definitions in a resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public virtual Pageable ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = RestClient.ListByResourceGroup(resourceGroupName, 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("ApplicationDefinitionsClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Deletes the managed application definition. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application definition to delete. + /// The cancellation token to use. + public virtual async ValueTask StartDeleteAsync(string resourceGroupName, string applicationDefinitionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationDefinitionName == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionName)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, applicationDefinitionName, cancellationToken).ConfigureAwait(false); + return new ApplicationDefinitionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, applicationDefinitionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes the managed application definition. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application definition to delete. + /// The cancellation token to use. + public virtual ApplicationDefinitionsDeleteOperation StartDelete(string resourceGroupName, string applicationDefinitionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationDefinitionName == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionName)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, applicationDefinitionName, cancellationToken); + return new ApplicationDefinitionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, applicationDefinitionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a new managed application definition. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application definition. + /// Parameters supplied to the create or update an managed application definition. + /// The cancellation token to use. + public virtual async ValueTask StartCreateOrUpdateAsync(string resourceGroupName, string applicationDefinitionName, ApplicationDefinition parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationDefinitionName == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, applicationDefinitionName, parameters, cancellationToken).ConfigureAwait(false); + return new ApplicationDefinitionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, applicationDefinitionName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a new managed application definition. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application definition. + /// Parameters supplied to the create or update an managed application definition. + /// The cancellation token to use. + public virtual ApplicationDefinitionsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string applicationDefinitionName, ApplicationDefinition parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationDefinitionName == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, applicationDefinitionName, parameters, cancellationToken); + return new ApplicationDefinitionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, applicationDefinitionName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes the managed application definition. + /// The fully qualified ID of the managed application definition, including the managed application name and the managed application definition resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. + /// The cancellation token to use. + public virtual async ValueTask StartDeleteByIdAsync(string applicationDefinitionId, CancellationToken cancellationToken = default) + { + if (applicationDefinitionId == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionId)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.StartDeleteById"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteByIdAsync(applicationDefinitionId, cancellationToken).ConfigureAwait(false); + return new ApplicationDefinitionsDeleteByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteByIdRequest(applicationDefinitionId).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes the managed application definition. + /// The fully qualified ID of the managed application definition, including the managed application name and the managed application definition resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. + /// The cancellation token to use. + public virtual ApplicationDefinitionsDeleteByIdOperation StartDeleteById(string applicationDefinitionId, CancellationToken cancellationToken = default) + { + if (applicationDefinitionId == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionId)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.StartDeleteById"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteById(applicationDefinitionId, cancellationToken); + return new ApplicationDefinitionsDeleteByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteByIdRequest(applicationDefinitionId).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a new managed application definition. + /// The fully qualified ID of the managed application definition, including the managed application name and the managed application definition resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. + /// Parameters supplied to the create or update a managed application definition. + /// The cancellation token to use. + public virtual async ValueTask StartCreateOrUpdateByIdAsync(string applicationDefinitionId, ApplicationDefinition parameters, CancellationToken cancellationToken = default) + { + if (applicationDefinitionId == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.StartCreateOrUpdateById"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateByIdAsync(applicationDefinitionId, parameters, cancellationToken).ConfigureAwait(false); + return new ApplicationDefinitionsCreateOrUpdateByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateByIdRequest(applicationDefinitionId, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a new managed application definition. + /// The fully qualified ID of the managed application definition, including the managed application name and the managed application definition resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. + /// Parameters supplied to the create or update a managed application definition. + /// The cancellation token to use. + public virtual ApplicationDefinitionsCreateOrUpdateByIdOperation StartCreateOrUpdateById(string applicationDefinitionId, ApplicationDefinition parameters, CancellationToken cancellationToken = default) + { + if (applicationDefinitionId == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationDefinitionsClient.StartCreateOrUpdateById"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdateById(applicationDefinitionId, parameters, cancellationToken); + return new ApplicationDefinitionsCreateOrUpdateByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateByIdRequest(applicationDefinitionId, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsCreateOrUpdateByIdOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsCreateOrUpdateByIdOperation.cs new file mode 100644 index 000000000000..7266b66559c6 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsCreateOrUpdateByIdOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Creates a new managed application definition. + public partial class ApplicationDefinitionsCreateOrUpdateByIdOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ApplicationDefinitionsCreateOrUpdateByIdOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ApplicationDefinitionsCreateOrUpdateByIdOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ApplicationDefinition 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); + + ApplicationDefinition IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsCreateOrUpdateOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..ec385b5a0bcc --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsCreateOrUpdateOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Creates a new managed application definition. + public partial class ApplicationDefinitionsCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ApplicationDefinitionsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ApplicationDefinitionsCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ApplicationDefinition 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); + + ApplicationDefinition IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsDeleteByIdOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsDeleteByIdOperation.cs new file mode 100644 index 000000000000..6f96fc8cf2a7 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsDeleteByIdOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// Deletes the managed application definition. + public partial class ApplicationDefinitionsDeleteByIdOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ApplicationDefinitionsDeleteByIdOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ApplicationDefinitionsDeleteByIdOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsDeleteOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsDeleteOperation.cs new file mode 100644 index 000000000000..62052ae51b4b --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsDeleteOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// Deletes the managed application definition. + public partial class ApplicationDefinitionsDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ApplicationDefinitionsDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ApplicationDefinitionsDeleteOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsRestClient.cs new file mode 100644 index 000000000000..39c981acf246 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationDefinitionsRestClient.cs @@ -0,0 +1,687 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class ApplicationDefinitionsRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ApplicationDefinitionsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public ApplicationDefinitionsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateGetRequest(string resourceGroupName, string applicationDefinitionName) + { + 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.Solutions/applicationDefinitions/", false); + uri.AppendPath(applicationDefinitionName, true); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + return message; + } + + /// Gets the managed application definition. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application definition. + /// The cancellation token to use. + public async ValueTask> GetAsync(string resourceGroupName, string applicationDefinitionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationDefinitionName == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionName)); + } + + using var message = CreateGetRequest(resourceGroupName, applicationDefinitionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApplicationDefinition value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue(null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the managed application definition. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application definition. + /// The cancellation token to use. + public Response Get(string resourceGroupName, string applicationDefinitionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationDefinitionName == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionName)); + } + + using var message = CreateGetRequest(resourceGroupName, applicationDefinitionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApplicationDefinition value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue(null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteRequest(string resourceGroupName, string applicationDefinitionName) + { + 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.Solutions/applicationDefinitions/", false); + uri.AppendPath(applicationDefinitionName, true); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + return message; + } + + /// Deletes the managed application definition. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application definition to delete. + /// The cancellation token to use. + public async ValueTask DeleteAsync(string resourceGroupName, string applicationDefinitionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationDefinitionName == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, applicationDefinitionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes the managed application definition. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application definition to delete. + /// The cancellation token to use. + public Response Delete(string resourceGroupName, string applicationDefinitionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationDefinitionName == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, applicationDefinitionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string applicationDefinitionName, ApplicationDefinition parameters) + { + 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.Solutions/applicationDefinitions/", false); + uri.AppendPath(applicationDefinitionName, true); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Creates a new managed application definition. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application definition. + /// Parameters supplied to the create or update an managed application definition. + /// The cancellation token to use. + public async ValueTask CreateOrUpdateAsync(string resourceGroupName, string applicationDefinitionName, ApplicationDefinition parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationDefinitionName == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, applicationDefinitionName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates a new managed application definition. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application definition. + /// Parameters supplied to the create or update an managed application definition. + /// The cancellation token to use. + public Response CreateOrUpdate(string resourceGroupName, string applicationDefinitionName, ApplicationDefinition parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationDefinitionName == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, applicationDefinitionName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByResourceGroupRequest(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.Solutions/applicationDefinitions", false); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + return message; + } + + /// Lists the managed application definitions in a resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public async ValueTask> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupRequest(resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApplicationDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationDefinitionListResult.DeserializeApplicationDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the managed application definitions in a resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public Response ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupRequest(resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApplicationDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationDefinitionListResult.DeserializeApplicationDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetByIdRequest(string applicationDefinitionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(applicationDefinitionId, false); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + return message; + } + + /// Gets the managed application definition. + /// The fully qualified ID of the managed application definition, including the managed application name and the managed application definition resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. + /// The cancellation token to use. + public async ValueTask> GetByIdAsync(string applicationDefinitionId, CancellationToken cancellationToken = default) + { + if (applicationDefinitionId == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionId)); + } + + using var message = CreateGetByIdRequest(applicationDefinitionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApplicationDefinition value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue(null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the managed application definition. + /// The fully qualified ID of the managed application definition, including the managed application name and the managed application definition resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. + /// The cancellation token to use. + public Response GetById(string applicationDefinitionId, CancellationToken cancellationToken = default) + { + if (applicationDefinitionId == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionId)); + } + + using var message = CreateGetByIdRequest(applicationDefinitionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApplicationDefinition value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue(null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteByIdRequest(string applicationDefinitionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(applicationDefinitionId, false); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + return message; + } + + /// Deletes the managed application definition. + /// The fully qualified ID of the managed application definition, including the managed application name and the managed application definition resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. + /// The cancellation token to use. + public async ValueTask DeleteByIdAsync(string applicationDefinitionId, CancellationToken cancellationToken = default) + { + if (applicationDefinitionId == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionId)); + } + + using var message = CreateDeleteByIdRequest(applicationDefinitionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes the managed application definition. + /// The fully qualified ID of the managed application definition, including the managed application name and the managed application definition resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. + /// The cancellation token to use. + public Response DeleteById(string applicationDefinitionId, CancellationToken cancellationToken = default) + { + if (applicationDefinitionId == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionId)); + } + + using var message = CreateDeleteByIdRequest(applicationDefinitionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateByIdRequest(string applicationDefinitionId, ApplicationDefinition parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(applicationDefinitionId, false); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Creates a new managed application definition. + /// The fully qualified ID of the managed application definition, including the managed application name and the managed application definition resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. + /// Parameters supplied to the create or update a managed application definition. + /// The cancellation token to use. + public async ValueTask CreateOrUpdateByIdAsync(string applicationDefinitionId, ApplicationDefinition parameters, CancellationToken cancellationToken = default) + { + if (applicationDefinitionId == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateByIdRequest(applicationDefinitionId, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates a new managed application definition. + /// The fully qualified ID of the managed application definition, including the managed application name and the managed application definition resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. + /// Parameters supplied to the create or update a managed application definition. + /// The cancellation token to use. + public Response CreateOrUpdateById(string applicationDefinitionId, ApplicationDefinition parameters, CancellationToken cancellationToken = default) + { + if (applicationDefinitionId == null) + { + throw new ArgumentNullException(nameof(applicationDefinitionId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateByIdRequest(applicationDefinitionId, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByResourceGroupNextPageRequest(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; + return message; + } + + /// Lists the managed application definitions 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. + public async ValueTask> ListByResourceGroupNextPageAsync(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 = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApplicationDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationDefinitionListResult.DeserializeApplicationDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the managed application definitions 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. + public Response ListByResourceGroupNextPage(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 = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApplicationDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationDefinitionListResult.DeserializeApplicationDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsClient.cs new file mode 100644 index 000000000000..1b509e2dfefb --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsClient.cs @@ -0,0 +1,584 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The Applications service client. + public partial class ApplicationsClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ApplicationsRestClient RestClient { get; } + /// Initializes a new instance of ApplicationsClient for mocking. + protected ApplicationsClient() + { + } + /// Initializes a new instance of ApplicationsClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal ApplicationsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ApplicationsRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the managed application. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string applicationName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, applicationName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the managed application. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string applicationName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, applicationName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// Parameters supplied to update an existing managed application. + /// The cancellation token to use. + public virtual async Task> UpdateAsync(string resourceGroupName, string applicationName, Application parameters = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.Update"); + scope.Start(); + try + { + return await RestClient.UpdateAsync(resourceGroupName, applicationName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// Parameters supplied to update an existing managed application. + /// The cancellation token to use. + public virtual Response Update(string resourceGroupName, string applicationName, Application parameters = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.Update"); + scope.Start(); + try + { + return RestClient.Update(resourceGroupName, applicationName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the managed application. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// The cancellation token to use. + public virtual async Task> GetByIdAsync(string applicationId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.GetById"); + scope.Start(); + try + { + return await RestClient.GetByIdAsync(applicationId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the managed application. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// The cancellation token to use. + public virtual Response GetById(string applicationId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.GetById"); + scope.Start(); + try + { + return RestClient.GetById(applicationId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// Parameters supplied to update an existing managed application. + /// The cancellation token to use. + public virtual async Task> UpdateByIdAsync(string applicationId, Application parameters = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.UpdateById"); + scope.Start(); + try + { + return await RestClient.UpdateByIdAsync(applicationId, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// Parameters supplied to update an existing managed application. + /// The cancellation token to use. + public virtual Response UpdateById(string applicationId, Application parameters = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.UpdateById"); + scope.Start(); + try + { + return RestClient.UpdateById(applicationId, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets all the applications within a resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, 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("ApplicationsClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, 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); + } + + /// Gets all the applications within a resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public virtual Pageable ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = RestClient.ListByResourceGroup(resourceGroupName, 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("ApplicationsClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all the applications within a subscription. + /// The cancellation token to use. + public virtual AsyncPageable ListBySubscriptionAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.ListBySubscription"); + scope.Start(); + try + { + var response = await RestClient.ListBySubscriptionAsync(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("ApplicationsClient.ListBySubscription"); + scope.Start(); + try + { + var response = await RestClient.ListBySubscriptionNextPageAsync(nextLink, 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); + } + + /// Gets all the applications within a subscription. + /// The cancellation token to use. + public virtual Pageable ListBySubscription(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.ListBySubscription"); + scope.Start(); + try + { + var response = RestClient.ListBySubscription(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("ApplicationsClient.ListBySubscription"); + scope.Start(); + try + { + var response = RestClient.ListBySubscriptionNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Deletes the managed application. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// The cancellation token to use. + public virtual async ValueTask StartDeleteAsync(string resourceGroupName, string applicationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationName == null) + { + throw new ArgumentNullException(nameof(applicationName)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, applicationName, cancellationToken).ConfigureAwait(false); + return new ApplicationsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, applicationName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes the managed application. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// The cancellation token to use. + public virtual ApplicationsDeleteOperation StartDelete(string resourceGroupName, string applicationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationName == null) + { + throw new ArgumentNullException(nameof(applicationName)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, applicationName, cancellationToken); + return new ApplicationsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, applicationName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a new managed application. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// Parameters supplied to the create or update a managed application. + /// The cancellation token to use. + public virtual async ValueTask StartCreateOrUpdateAsync(string resourceGroupName, string applicationName, Application parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationName == null) + { + throw new ArgumentNullException(nameof(applicationName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, applicationName, parameters, cancellationToken).ConfigureAwait(false); + return new ApplicationsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, applicationName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a new managed application. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// Parameters supplied to the create or update a managed application. + /// The cancellation token to use. + public virtual ApplicationsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string applicationName, Application parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationName == null) + { + throw new ArgumentNullException(nameof(applicationName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, applicationName, parameters, cancellationToken); + return new ApplicationsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, applicationName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes the managed application. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// The cancellation token to use. + public virtual async ValueTask StartDeleteByIdAsync(string applicationId, CancellationToken cancellationToken = default) + { + if (applicationId == null) + { + throw new ArgumentNullException(nameof(applicationId)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.StartDeleteById"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteByIdAsync(applicationId, cancellationToken).ConfigureAwait(false); + return new ApplicationsDeleteByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteByIdRequest(applicationId).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes the managed application. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// The cancellation token to use. + public virtual ApplicationsDeleteByIdOperation StartDeleteById(string applicationId, CancellationToken cancellationToken = default) + { + if (applicationId == null) + { + throw new ArgumentNullException(nameof(applicationId)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.StartDeleteById"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteById(applicationId, cancellationToken); + return new ApplicationsDeleteByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteByIdRequest(applicationId).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a new managed application. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// Parameters supplied to the create or update a managed application. + /// The cancellation token to use. + public virtual async ValueTask StartCreateOrUpdateByIdAsync(string applicationId, Application parameters, CancellationToken cancellationToken = default) + { + if (applicationId == null) + { + throw new ArgumentNullException(nameof(applicationId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.StartCreateOrUpdateById"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateByIdAsync(applicationId, parameters, cancellationToken).ConfigureAwait(false); + return new ApplicationsCreateOrUpdateByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateByIdRequest(applicationId, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a new managed application. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// Parameters supplied to the create or update a managed application. + /// The cancellation token to use. + public virtual ApplicationsCreateOrUpdateByIdOperation StartCreateOrUpdateById(string applicationId, Application parameters, CancellationToken cancellationToken = default) + { + if (applicationId == null) + { + throw new ArgumentNullException(nameof(applicationId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ApplicationsClient.StartCreateOrUpdateById"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdateById(applicationId, parameters, cancellationToken); + return new ApplicationsCreateOrUpdateByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateByIdRequest(applicationId, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsCreateOrUpdateByIdOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsCreateOrUpdateByIdOperation.cs new file mode 100644 index 000000000000..f6be0fa85a88 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsCreateOrUpdateByIdOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Creates a new managed application. + public partial class ApplicationsCreateOrUpdateByIdOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ApplicationsCreateOrUpdateByIdOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ApplicationsCreateOrUpdateByIdOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Application 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); + + Application IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return Application.DeserializeApplication(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return Application.DeserializeApplication(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsCreateOrUpdateOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..253556d99aa3 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsCreateOrUpdateOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Creates a new managed application. + public partial class ApplicationsCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ApplicationsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ApplicationsCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Application 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); + + Application IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return Application.DeserializeApplication(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return Application.DeserializeApplication(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsDeleteByIdOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsDeleteByIdOperation.cs new file mode 100644 index 000000000000..90e254c45368 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsDeleteByIdOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// Deletes the managed application. + public partial class ApplicationsDeleteByIdOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ApplicationsDeleteByIdOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ApplicationsDeleteByIdOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsDeleteOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsDeleteOperation.cs new file mode 100644 index 000000000000..5dc4734067b1 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsDeleteOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// Deletes the managed application. + public partial class ApplicationsDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ApplicationsDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ApplicationsDeleteOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsRestClient.cs new file mode 100644 index 000000000000..32da8480d400 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ApplicationsRestClient.cs @@ -0,0 +1,1026 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class ApplicationsRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ApplicationsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public ApplicationsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateGetRequest(string resourceGroupName, string applicationName) + { + 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.Solutions/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + return message; + } + + /// Gets the managed application. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// The cancellation token to use. + public async ValueTask> GetAsync(string resourceGroupName, string applicationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationName == null) + { + throw new ArgumentNullException(nameof(applicationName)); + } + + using var message = CreateGetRequest(resourceGroupName, applicationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Application value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Application.DeserializeApplication(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue(null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the managed application. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// The cancellation token to use. + public Response Get(string resourceGroupName, string applicationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationName == null) + { + throw new ArgumentNullException(nameof(applicationName)); + } + + using var message = CreateGetRequest(resourceGroupName, applicationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Application value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Application.DeserializeApplication(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue(null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteRequest(string resourceGroupName, string applicationName) + { + 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.Solutions/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + return message; + } + + /// Deletes the managed application. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// The cancellation token to use. + public async ValueTask DeleteAsync(string resourceGroupName, string applicationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationName == null) + { + throw new ArgumentNullException(nameof(applicationName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, applicationName); + 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); + } + } + + /// Deletes the managed application. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// The cancellation token to use. + public Response Delete(string resourceGroupName, string applicationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationName == null) + { + throw new ArgumentNullException(nameof(applicationName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, applicationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string applicationName, Application parameters) + { + 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.Solutions/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Creates a new managed application. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// Parameters supplied to the create or update a managed application. + /// The cancellation token to use. + public async ValueTask CreateOrUpdateAsync(string resourceGroupName, string applicationName, Application parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationName == null) + { + throw new ArgumentNullException(nameof(applicationName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, applicationName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates a new managed application. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// Parameters supplied to the create or update a managed application. + /// The cancellation token to use. + public Response CreateOrUpdate(string resourceGroupName, string applicationName, Application parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationName == null) + { + throw new ArgumentNullException(nameof(applicationName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, applicationName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateUpdateRequest(string resourceGroupName, string applicationName, Application parameters) + { + 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.Solutions/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + if (parameters != null) + { + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + } + return message; + } + + /// Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// Parameters supplied to update an existing managed application. + /// The cancellation token to use. + public async ValueTask> UpdateAsync(string resourceGroupName, string applicationName, Application parameters = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationName == null) + { + throw new ArgumentNullException(nameof(applicationName)); + } + + using var message = CreateUpdateRequest(resourceGroupName, applicationName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Application value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Application.DeserializeApplication(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed application. + /// Parameters supplied to update an existing managed application. + /// The cancellation token to use. + public Response Update(string resourceGroupName, string applicationName, Application parameters = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (applicationName == null) + { + throw new ArgumentNullException(nameof(applicationName)); + } + + using var message = CreateUpdateRequest(resourceGroupName, applicationName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Application value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Application.DeserializeApplication(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByResourceGroupRequest(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.Solutions/applications", false); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + return message; + } + + /// Gets all the applications within a resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public async ValueTask> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupRequest(resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApplicationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the applications within a resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public Response ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupRequest(resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApplicationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListBySubscriptionRequest() + { + 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.Solutions/applications", false); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + return message; + } + + /// Gets all the applications within a subscription. + /// The cancellation token to use. + public async ValueTask> ListBySubscriptionAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListBySubscriptionRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApplicationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the applications within a subscription. + /// The cancellation token to use. + public Response ListBySubscription(CancellationToken cancellationToken = default) + { + using var message = CreateListBySubscriptionRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApplicationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetByIdRequest(string applicationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(applicationId, false); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + return message; + } + + /// Gets the managed application. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// The cancellation token to use. + public async ValueTask> GetByIdAsync(string applicationId, CancellationToken cancellationToken = default) + { + if (applicationId == null) + { + throw new ArgumentNullException(nameof(applicationId)); + } + + using var message = CreateGetByIdRequest(applicationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Application value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Application.DeserializeApplication(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue(null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the managed application. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// The cancellation token to use. + public Response GetById(string applicationId, CancellationToken cancellationToken = default) + { + if (applicationId == null) + { + throw new ArgumentNullException(nameof(applicationId)); + } + + using var message = CreateGetByIdRequest(applicationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Application value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Application.DeserializeApplication(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue(null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteByIdRequest(string applicationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(applicationId, false); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + return message; + } + + /// Deletes the managed application. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// The cancellation token to use. + public async ValueTask DeleteByIdAsync(string applicationId, CancellationToken cancellationToken = default) + { + if (applicationId == null) + { + throw new ArgumentNullException(nameof(applicationId)); + } + + using var message = CreateDeleteByIdRequest(applicationId); + 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); + } + } + + /// Deletes the managed application. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// The cancellation token to use. + public Response DeleteById(string applicationId, CancellationToken cancellationToken = default) + { + if (applicationId == null) + { + throw new ArgumentNullException(nameof(applicationId)); + } + + using var message = CreateDeleteByIdRequest(applicationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateByIdRequest(string applicationId, Application parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(applicationId, false); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Creates a new managed application. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// Parameters supplied to the create or update a managed application. + /// The cancellation token to use. + public async ValueTask CreateOrUpdateByIdAsync(string applicationId, Application parameters, CancellationToken cancellationToken = default) + { + if (applicationId == null) + { + throw new ArgumentNullException(nameof(applicationId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateByIdRequest(applicationId, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates a new managed application. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// Parameters supplied to the create or update a managed application. + /// The cancellation token to use. + public Response CreateOrUpdateById(string applicationId, Application parameters, CancellationToken cancellationToken = default) + { + if (applicationId == null) + { + throw new ArgumentNullException(nameof(applicationId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateByIdRequest(applicationId, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateUpdateByIdRequest(string applicationId, Application parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(applicationId, false); + uri.AppendQuery("api-version", "2018-06-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + if (parameters != null) + { + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + } + return message; + } + + /// Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// Parameters supplied to update an existing managed application. + /// The cancellation token to use. + public async ValueTask> UpdateByIdAsync(string applicationId, Application parameters = null, CancellationToken cancellationToken = default) + { + if (applicationId == null) + { + throw new ArgumentNullException(nameof(applicationId)); + } + + using var message = CreateUpdateByIdRequest(applicationId, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Application value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Application.DeserializeApplication(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + /// The fully qualified ID of the managed application, including the managed application name and the managed application resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + /// Parameters supplied to update an existing managed application. + /// The cancellation token to use. + public Response UpdateById(string applicationId, Application parameters = null, CancellationToken cancellationToken = default) + { + if (applicationId == null) + { + throw new ArgumentNullException(nameof(applicationId)); + } + + using var message = CreateUpdateByIdRequest(applicationId, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Application value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Application.DeserializeApplication(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByResourceGroupNextPageRequest(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; + return message; + } + + /// Gets all the applications within 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. + public async ValueTask> ListByResourceGroupNextPageAsync(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 = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApplicationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the applications within 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. + public Response ListByResourceGroupNextPage(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 = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApplicationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListBySubscriptionNextPageRequest(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; + return message; + } + + /// Gets all the applications within a subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + public async ValueTask> ListBySubscriptionNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListBySubscriptionNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApplicationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the applications within a subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + public Response ListBySubscriptionNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListBySubscriptionNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApplicationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/AuthorizationClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/AuthorizationClient.cs new file mode 100644 index 000000000000..d61c738a889e --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/AuthorizationClient.cs @@ -0,0 +1,113 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The Authorization service client. + public partial class AuthorizationClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal AuthorizationRestClient RestClient { get; } + /// Initializes a new instance of AuthorizationClient for mocking. + protected AuthorizationClient() + { + } + /// Initializes a new instance of AuthorizationClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + internal AuthorizationClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + RestClient = new AuthorizationRestClient(clientDiagnostics, pipeline, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Lists all of the available Microsoft.Authorization REST API operations. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("AuthorizationClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(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("AuthorizationClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, 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); + } + + /// Lists all of the available Microsoft.Authorization REST API operations. + /// The cancellation token to use. + public virtual Pageable List(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("AuthorizationClient.List"); + scope.Start(); + try + { + var response = RestClient.List(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("AuthorizationClient.List"); + scope.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/AuthorizationRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/AuthorizationRestClient.cs new file mode 100644 index 000000000000..75be288b7c55 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/AuthorizationRestClient.cs @@ -0,0 +1,183 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class AuthorizationRestClient + { + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of AuthorizationRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + public AuthorizationRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + endpoint ??= new Uri("https://management.azure.com"); + + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Authorization/operations", false); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Lists all of the available Microsoft.Authorization REST API operations. + /// The cancellation token to use. + public async ValueTask> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResultAutoGenerated2 value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = OperationListResultAutoGenerated2.DeserializeOperationListResultAutoGenerated2(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists all of the available Microsoft.Authorization REST API operations. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResultAutoGenerated2 value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = OperationListResultAutoGenerated2.DeserializeOperationListResultAutoGenerated2(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListNextPageRequest(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; + return message; + } + + /// Lists all of the available Microsoft.Authorization REST API operations. + /// The URL to the next page of results. + /// The cancellation token to use. + public async ValueTask> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResultAutoGenerated2 value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = OperationListResultAutoGenerated2.DeserializeOperationListResultAutoGenerated2(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists all of the available Microsoft.Authorization REST API operations. + /// The URL to the next page of results. + /// The cancellation token to use. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResultAutoGenerated2 value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = OperationListResultAutoGenerated2.DeserializeOperationListResultAutoGenerated2(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentClient.cs new file mode 100644 index 000000000000..f87088fde6df --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentClient.cs @@ -0,0 +1,706 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The Deployment service client. + public partial class DeploymentClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DeploymentRestClient RestClient { get; } + /// Initializes a new instance of DeploymentClient for mocking. + protected DeploymentClient() + { + } + /// Initializes a new instance of DeploymentClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal DeploymentClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DeploymentRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a deployments operation. + /// The resource scope. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public virtual async Task> GetAtScopeAsync(string scope, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.GetAtScope"); + scope0.Start(); + try + { + return await RestClient.GetAtScopeAsync(scope, deploymentName, operationId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployments operation. + /// The resource scope. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public virtual Response GetAtScope(string scope, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.GetAtScope"); + scope0.Start(); + try + { + return RestClient.GetAtScope(scope, deploymentName, operationId, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployments operation. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public virtual async Task> GetAtTenantScopeAsync(string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.GetAtTenantScope"); + scope0.Start(); + try + { + return await RestClient.GetAtTenantScopeAsync(deploymentName, operationId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployments operation. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public virtual Response GetAtTenantScope(string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.GetAtTenantScope"); + scope0.Start(); + try + { + return RestClient.GetAtTenantScope(deploymentName, operationId, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployments operation. + /// The management group ID. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public virtual async Task> GetAtManagementGroupScopeAsync(string groupId, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.GetAtManagementGroupScope"); + scope0.Start(); + try + { + return await RestClient.GetAtManagementGroupScopeAsync(groupId, deploymentName, operationId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployments operation. + /// The management group ID. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public virtual Response GetAtManagementGroupScope(string groupId, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.GetAtManagementGroupScope"); + scope0.Start(); + try + { + return RestClient.GetAtManagementGroupScope(groupId, deploymentName, operationId, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployments operation. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public virtual async Task> GetAtSubscriptionScopeAsync(string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.GetAtSubscriptionScope"); + scope0.Start(); + try + { + return await RestClient.GetAtSubscriptionScopeAsync(deploymentName, operationId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployments operation. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public virtual Response GetAtSubscriptionScope(string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.GetAtSubscriptionScope"); + scope0.Start(); + try + { + return RestClient.GetAtSubscriptionScope(deploymentName, operationId, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployments operation. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.Get"); + scope0.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, deploymentName, operationId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployments operation. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.Get"); + scope0.Start(); + try + { + return RestClient.Get(resourceGroupName, deploymentName, operationId, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets all deployments operations for a deployment. + /// The resource scope. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public virtual AsyncPageable ListAtScopeAsync(string scope, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtScopeAsync(scope, deploymentName, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtScopeNextPageAsync(nextLink, scope, deploymentName, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all deployments operations for a deployment. + /// The resource scope. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public virtual Pageable ListAtScope(string scope, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtScope(scope, deploymentName, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtScopeNextPage(nextLink, scope, deploymentName, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all deployments operations for a deployment. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public virtual AsyncPageable ListAtTenantScopeAsync(string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtTenantScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtTenantScopeAsync(deploymentName, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtTenantScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtTenantScopeNextPageAsync(nextLink, deploymentName, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all deployments operations for a deployment. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public virtual Pageable ListAtTenantScope(string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtTenantScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtTenantScope(deploymentName, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtTenantScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtTenantScopeNextPage(nextLink, deploymentName, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all deployments operations for a deployment. + /// The management group ID. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public virtual AsyncPageable ListAtManagementGroupScopeAsync(string groupId, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtManagementGroupScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtManagementGroupScopeAsync(groupId, deploymentName, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtManagementGroupScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtManagementGroupScopeNextPageAsync(nextLink, groupId, deploymentName, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all deployments operations for a deployment. + /// The management group ID. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public virtual Pageable ListAtManagementGroupScope(string groupId, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtManagementGroupScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtManagementGroupScope(groupId, deploymentName, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtManagementGroupScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtManagementGroupScopeNextPage(nextLink, groupId, deploymentName, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all deployments operations for a deployment. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public virtual AsyncPageable ListAtSubscriptionScopeAsync(string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtSubscriptionScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtSubscriptionScopeAsync(deploymentName, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtSubscriptionScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtSubscriptionScopeNextPageAsync(nextLink, deploymentName, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all deployments operations for a deployment. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public virtual Pageable ListAtSubscriptionScope(string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtSubscriptionScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtSubscriptionScope(deploymentName, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.ListAtSubscriptionScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtSubscriptionScopeNextPage(nextLink, deploymentName, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all deployments operations for a deployment. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(string resourceGroupName, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.List"); + scope0.Start(); + try + { + var response = await RestClient.ListAsync(resourceGroupName, deploymentName, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.List"); + scope0.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, deploymentName, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all deployments operations for a deployment. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public virtual Pageable List(string resourceGroupName, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.List"); + scope0.Start(); + try + { + var response = RestClient.List(resourceGroupName, deploymentName, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentClient.List"); + scope0.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, resourceGroupName, deploymentName, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentRestClient.cs new file mode 100644 index 000000000000..046324d2dc3f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentRestClient.cs @@ -0,0 +1,1501 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class DeploymentRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DeploymentRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public DeploymentRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateGetAtScopeRequest(string scope, string deploymentName, string operationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets a deployments operation. + /// The resource scope. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public async ValueTask> GetAtScopeAsync(string scope, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (operationId == null) + { + throw new ArgumentNullException(nameof(operationId)); + } + + using var message = CreateGetAtScopeRequest(scope, deploymentName, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperation value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperation.DeserializeDeploymentOperation(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a deployments operation. + /// The resource scope. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public Response GetAtScope(string scope, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (operationId == null) + { + throw new ArgumentNullException(nameof(operationId)); + } + + using var message = CreateGetAtScopeRequest(scope, deploymentName, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperation value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperation.DeserializeDeploymentOperation(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtScopeRequest(string scope, string deploymentName, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations", false); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets all deployments operations for a deployment. + /// The resource scope. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public async ValueTask> ListAtScopeAsync(string scope, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtScopeRequest(scope, deploymentName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all deployments operations for a deployment. + /// The resource scope. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public Response ListAtScope(string scope, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtScopeRequest(scope, deploymentName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtTenantScopeRequest(string deploymentName, string operationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets a deployments operation. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public async ValueTask> GetAtTenantScopeAsync(string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (operationId == null) + { + throw new ArgumentNullException(nameof(operationId)); + } + + using var message = CreateGetAtTenantScopeRequest(deploymentName, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperation value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperation.DeserializeDeploymentOperation(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a deployments operation. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public Response GetAtTenantScope(string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (operationId == null) + { + throw new ArgumentNullException(nameof(operationId)); + } + + using var message = CreateGetAtTenantScopeRequest(deploymentName, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperation value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperation.DeserializeDeploymentOperation(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtTenantScopeRequest(string deploymentName, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations", false); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets all deployments operations for a deployment. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public async ValueTask> ListAtTenantScopeAsync(string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtTenantScopeRequest(deploymentName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all deployments operations for a deployment. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public Response ListAtTenantScope(string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtTenantScopeRequest(deploymentName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtManagementGroupScopeRequest(string groupId, string deploymentName, string operationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets a deployments operation. + /// The management group ID. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public async ValueTask> GetAtManagementGroupScopeAsync(string groupId, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (operationId == null) + { + throw new ArgumentNullException(nameof(operationId)); + } + + using var message = CreateGetAtManagementGroupScopeRequest(groupId, deploymentName, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperation value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperation.DeserializeDeploymentOperation(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a deployments operation. + /// The management group ID. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public Response GetAtManagementGroupScope(string groupId, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (operationId == null) + { + throw new ArgumentNullException(nameof(operationId)); + } + + using var message = CreateGetAtManagementGroupScopeRequest(groupId, deploymentName, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperation value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperation.DeserializeDeploymentOperation(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtManagementGroupScopeRequest(string groupId, string deploymentName, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations", false); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets all deployments operations for a deployment. + /// The management group ID. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public async ValueTask> ListAtManagementGroupScopeAsync(string groupId, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtManagementGroupScopeRequest(groupId, deploymentName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all deployments operations for a deployment. + /// The management group ID. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public Response ListAtManagementGroupScope(string groupId, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtManagementGroupScopeRequest(groupId, deploymentName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtSubscriptionScopeRequest(string deploymentName, string operationId) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets a deployments operation. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public async ValueTask> GetAtSubscriptionScopeAsync(string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (operationId == null) + { + throw new ArgumentNullException(nameof(operationId)); + } + + using var message = CreateGetAtSubscriptionScopeRequest(deploymentName, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperation value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperation.DeserializeDeploymentOperation(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a deployments operation. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public Response GetAtSubscriptionScope(string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (operationId == null) + { + throw new ArgumentNullException(nameof(operationId)); + } + + using var message = CreateGetAtSubscriptionScopeRequest(deploymentName, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperation value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperation.DeserializeDeploymentOperation(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtSubscriptionScopeRequest(string deploymentName, int? top) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations", false); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets all deployments operations for a deployment. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public async ValueTask> ListAtSubscriptionScopeAsync(string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtSubscriptionScopeRequest(deploymentName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all deployments operations for a deployment. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public Response ListAtSubscriptionScope(string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtSubscriptionScopeRequest(deploymentName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetRequest(string resourceGroupName, string deploymentName, string operationId) + { + 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("/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets a deployments operation. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public async ValueTask> GetAsync(string resourceGroupName, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (operationId == null) + { + throw new ArgumentNullException(nameof(operationId)); + } + + using var message = CreateGetRequest(resourceGroupName, deploymentName, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperation value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperation.DeserializeDeploymentOperation(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a deployments operation. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + public Response Get(string resourceGroupName, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (operationId == null) + { + throw new ArgumentNullException(nameof(operationId)); + } + + using var message = CreateGetRequest(resourceGroupName, deploymentName, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperation value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperation.DeserializeDeploymentOperation(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListRequest(string resourceGroupName, string deploymentName, int? top) + { + 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("/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations", false); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets all deployments operations for a deployment. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public async ValueTask> ListAsync(string resourceGroupName, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListRequest(resourceGroupName, deploymentName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all deployments operations for a deployment. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public Response List(string resourceGroupName, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListRequest(resourceGroupName, deploymentName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtScopeNextPageRequest(string nextLink, string scope, string deploymentName, int? top) + { + 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; + return message; + } + + /// Gets all deployments operations for a deployment. + /// The URL to the next page of results. + /// The resource scope. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public async ValueTask> ListAtScopeNextPageAsync(string nextLink, string scope, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtScopeNextPageRequest(nextLink, scope, deploymentName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all deployments operations for a deployment. + /// The URL to the next page of results. + /// The resource scope. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public Response ListAtScopeNextPage(string nextLink, string scope, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtScopeNextPageRequest(nextLink, scope, deploymentName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtTenantScopeNextPageRequest(string nextLink, string deploymentName, int? top) + { + 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; + return message; + } + + /// Gets all deployments operations for a deployment. + /// The URL to the next page of results. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public async ValueTask> ListAtTenantScopeNextPageAsync(string nextLink, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtTenantScopeNextPageRequest(nextLink, deploymentName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all deployments operations for a deployment. + /// The URL to the next page of results. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public Response ListAtTenantScopeNextPage(string nextLink, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtTenantScopeNextPageRequest(nextLink, deploymentName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtManagementGroupScopeNextPageRequest(string nextLink, string groupId, string deploymentName, int? top) + { + 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; + return message; + } + + /// Gets all deployments operations for a deployment. + /// The URL to the next page of results. + /// The management group ID. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public async ValueTask> ListAtManagementGroupScopeNextPageAsync(string nextLink, string groupId, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtManagementGroupScopeNextPageRequest(nextLink, groupId, deploymentName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all deployments operations for a deployment. + /// The URL to the next page of results. + /// The management group ID. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public Response ListAtManagementGroupScopeNextPage(string nextLink, string groupId, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtManagementGroupScopeNextPageRequest(nextLink, groupId, deploymentName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtSubscriptionScopeNextPageRequest(string nextLink, string deploymentName, int? top) + { + 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; + return message; + } + + /// Gets all deployments operations for a deployment. + /// The URL to the next page of results. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public async ValueTask> ListAtSubscriptionScopeNextPageAsync(string nextLink, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtSubscriptionScopeNextPageRequest(nextLink, deploymentName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all deployments operations for a deployment. + /// The URL to the next page of results. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public Response ListAtSubscriptionScopeNextPage(string nextLink, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListAtSubscriptionScopeNextPageRequest(nextLink, deploymentName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string deploymentName, int? top) + { + 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; + return message; + } + + /// Gets all deployments operations for a deployment. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public async ValueTask> ListNextPageAsync(string nextLink, string resourceGroupName, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListNextPageRequest(nextLink, resourceGroupName, deploymentName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all deployments operations for a deployment. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + public Response ListNextPage(string nextLink, string resourceGroupName, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateListNextPageRequest(nextLink, resourceGroupName, deploymentName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentOperationsListResult.DeserializeDeploymentOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentScriptsClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentScriptsClient.cs new file mode 100644 index 000000000000..1e6df0b08dbf --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentScriptsClient.cs @@ -0,0 +1,462 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The DeploymentScripts service client. + public partial class DeploymentScriptsClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DeploymentScriptsRestClient RestClient { get; } + /// Initializes a new instance of DeploymentScriptsClient for mocking. + protected DeploymentScriptsClient() + { + } + /// Initializes a new instance of DeploymentScriptsClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal DeploymentScriptsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DeploymentScriptsRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Updates deployment script tags with specified values. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// Deployment script resource with the tags to be updated. + /// The cancellation token to use. + public virtual async Task> UpdateAsync(string resourceGroupName, string scriptName, DeploymentScriptUpdateParameter deploymentScript = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.Update"); + scope.Start(); + try + { + return await RestClient.UpdateAsync(resourceGroupName, scriptName, deploymentScript, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates deployment script tags with specified values. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// Deployment script resource with the tags to be updated. + /// The cancellation token to use. + public virtual Response Update(string resourceGroupName, string scriptName, DeploymentScriptUpdateParameter deploymentScript = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.Update"); + scope.Start(); + try + { + return RestClient.Update(resourceGroupName, scriptName, deploymentScript, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a deployment script with a given name. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string scriptName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, scriptName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a deployment script with a given name. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string scriptName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, scriptName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a deployment script. When operation completes, status code 200 returned without content. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The cancellation token to use. + public virtual async Task DeleteAsync(string resourceGroupName, string scriptName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.Delete"); + scope.Start(); + try + { + return await RestClient.DeleteAsync(resourceGroupName, scriptName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a deployment script. When operation completes, status code 200 returned without content. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The cancellation token to use. + public virtual Response Delete(string resourceGroupName, string scriptName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.Delete"); + scope.Start(); + try + { + return RestClient.Delete(resourceGroupName, scriptName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets deployment script logs for a given deployment script name. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The cancellation token to use. + public virtual async Task> GetLogsAsync(string resourceGroupName, string scriptName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.GetLogs"); + scope.Start(); + try + { + return await RestClient.GetLogsAsync(resourceGroupName, scriptName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets deployment script logs for a given deployment script name. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The cancellation token to use. + public virtual Response GetLogs(string resourceGroupName, string scriptName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.GetLogs"); + scope.Start(); + try + { + return RestClient.GetLogs(resourceGroupName, scriptName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets deployment script logs for a given deployment script name. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The number of lines to show from the tail of the deployment script log. Valid value is a positive number up to 1000. If 'tail' is not provided, all available logs are shown up to container instance log capacity of 4mb. + /// The cancellation token to use. + public virtual async Task> GetLogsDefaultAsync(string resourceGroupName, string scriptName, int? tail = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.GetLogsDefault"); + scope.Start(); + try + { + return await RestClient.GetLogsDefaultAsync(resourceGroupName, scriptName, tail, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets deployment script logs for a given deployment script name. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The number of lines to show from the tail of the deployment script log. Valid value is a positive number up to 1000. If 'tail' is not provided, all available logs are shown up to container instance log capacity of 4mb. + /// The cancellation token to use. + public virtual Response GetLogsDefault(string resourceGroupName, string scriptName, int? tail = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.GetLogsDefault"); + scope.Start(); + try + { + return RestClient.GetLogsDefault(resourceGroupName, scriptName, tail, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all deployment scripts for a given subscription. + /// The cancellation token to use. + public virtual AsyncPageable ListBySubscriptionAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.ListBySubscription"); + scope.Start(); + try + { + var response = await RestClient.ListBySubscriptionAsync(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("DeploymentScriptsClient.ListBySubscription"); + scope.Start(); + try + { + var response = await RestClient.ListBySubscriptionNextPageAsync(nextLink, 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); + } + + /// Lists all deployment scripts for a given subscription. + /// The cancellation token to use. + public virtual Pageable ListBySubscription(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.ListBySubscription"); + scope.Start(); + try + { + var response = RestClient.ListBySubscription(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("DeploymentScriptsClient.ListBySubscription"); + scope.Start(); + try + { + var response = RestClient.ListBySubscriptionNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Lists deployments scripts. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, 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("DeploymentScriptsClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, 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); + } + + /// Lists deployments scripts. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public virtual Pageable ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = RestClient.ListByResourceGroup(resourceGroupName, 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("DeploymentScriptsClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Creates a deployment script. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// Deployment script supplied to the operation. + /// The cancellation token to use. + public virtual async ValueTask StartCreateAsync(string resourceGroupName, string scriptName, DeploymentScript deploymentScript, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + if (deploymentScript == null) + { + throw new ArgumentNullException(nameof(deploymentScript)); + } + + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.StartCreate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateAsync(resourceGroupName, scriptName, deploymentScript, cancellationToken).ConfigureAwait(false); + return new DeploymentScriptsCreateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateRequest(resourceGroupName, scriptName, deploymentScript).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a deployment script. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// Deployment script supplied to the operation. + /// The cancellation token to use. + public virtual DeploymentScriptsCreateOperation StartCreate(string resourceGroupName, string scriptName, DeploymentScript deploymentScript, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + if (deploymentScript == null) + { + throw new ArgumentNullException(nameof(deploymentScript)); + } + + using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsClient.StartCreate"); + scope.Start(); + try + { + var originalResponse = RestClient.Create(resourceGroupName, scriptName, deploymentScript, cancellationToken); + return new DeploymentScriptsCreateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateRequest(resourceGroupName, scriptName, deploymentScript).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentScriptsCreateOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentScriptsCreateOperation.cs new file mode 100644 index 000000000000..916055449979 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentScriptsCreateOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Creates a deployment script. + public partial class DeploymentScriptsCreateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentScriptsCreateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentScriptsCreateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DeploymentScript 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); + + DeploymentScript IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentScript.DeserializeDeploymentScript(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentScript.DeserializeDeploymentScript(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentScriptsRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentScriptsRestClient.cs new file mode 100644 index 000000000000..155a731f5d36 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentScriptsRestClient.cs @@ -0,0 +1,915 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class DeploymentScriptsRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DeploymentScriptsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public DeploymentScriptsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateCreateRequest(string resourceGroupName, string scriptName, DeploymentScript deploymentScript) + { + 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.Resources/deploymentScripts/", false); + uri.AppendPath(scriptName, true); + uri.AppendQuery("api-version", "2019-10-01-preview", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(deploymentScript); + request.Content = content; + return message; + } + + /// Creates a deployment script. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// Deployment script supplied to the operation. + /// The cancellation token to use. + public async ValueTask CreateAsync(string resourceGroupName, string scriptName, DeploymentScript deploymentScript, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + if (deploymentScript == null) + { + throw new ArgumentNullException(nameof(deploymentScript)); + } + + using var message = CreateCreateRequest(resourceGroupName, scriptName, deploymentScript); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates a deployment script. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// Deployment script supplied to the operation. + /// The cancellation token to use. + public Response Create(string resourceGroupName, string scriptName, DeploymentScript deploymentScript, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + if (deploymentScript == null) + { + throw new ArgumentNullException(nameof(deploymentScript)); + } + + using var message = CreateCreateRequest(resourceGroupName, scriptName, deploymentScript); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateUpdateRequest(string resourceGroupName, string scriptName, DeploymentScriptUpdateParameter deploymentScript) + { + 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.Resources/deploymentScripts/", false); + uri.AppendPath(scriptName, true); + uri.AppendQuery("api-version", "2019-10-01-preview", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + if (deploymentScript != null) + { + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(deploymentScript); + request.Content = content; + } + return message; + } + + /// Updates deployment script tags with specified values. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// Deployment script resource with the tags to be updated. + /// The cancellation token to use. + public async ValueTask> UpdateAsync(string resourceGroupName, string scriptName, DeploymentScriptUpdateParameter deploymentScript = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + + using var message = CreateUpdateRequest(resourceGroupName, scriptName, deploymentScript); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentScript value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentScript.DeserializeDeploymentScript(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Updates deployment script tags with specified values. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// Deployment script resource with the tags to be updated. + /// The cancellation token to use. + public Response Update(string resourceGroupName, string scriptName, DeploymentScriptUpdateParameter deploymentScript = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + + using var message = CreateUpdateRequest(resourceGroupName, scriptName, deploymentScript); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentScript value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentScript.DeserializeDeploymentScript(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetRequest(string resourceGroupName, string scriptName) + { + 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.Resources/deploymentScripts/", false); + uri.AppendPath(scriptName, true); + uri.AppendQuery("api-version", "2019-10-01-preview", true); + request.Uri = uri; + return message; + } + + /// Gets a deployment script with a given name. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The cancellation token to use. + public async ValueTask> GetAsync(string resourceGroupName, string scriptName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + + using var message = CreateGetRequest(resourceGroupName, scriptName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentScript value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentScript.DeserializeDeploymentScript(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a deployment script with a given name. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The cancellation token to use. + public Response Get(string resourceGroupName, string scriptName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + + using var message = CreateGetRequest(resourceGroupName, scriptName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentScript value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentScript.DeserializeDeploymentScript(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteRequest(string resourceGroupName, string scriptName) + { + 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.Resources/deploymentScripts/", false); + uri.AppendPath(scriptName, true); + uri.AppendQuery("api-version", "2019-10-01-preview", true); + request.Uri = uri; + return message; + } + + /// Deletes a deployment script. When operation completes, status code 200 returned without content. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The cancellation token to use. + public async ValueTask DeleteAsync(string resourceGroupName, string scriptName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, scriptName); + 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); + } + } + + /// Deletes a deployment script. When operation completes, status code 200 returned without content. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The cancellation token to use. + public Response Delete(string resourceGroupName, string scriptName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, scriptName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListBySubscriptionRequest() + { + 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.Resources/deploymentScripts", false); + uri.AppendQuery("api-version", "2019-10-01-preview", true); + request.Uri = uri; + return message; + } + + /// Lists all deployment scripts for a given subscription. + /// The cancellation token to use. + public async ValueTask> ListBySubscriptionAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListBySubscriptionRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentScriptListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists all deployment scripts for a given subscription. + /// The cancellation token to use. + public Response ListBySubscription(CancellationToken cancellationToken = default) + { + using var message = CreateListBySubscriptionRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentScriptListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetLogsRequest(string resourceGroupName, string scriptName) + { + 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.Resources/deploymentScripts/", false); + uri.AppendPath(scriptName, true); + uri.AppendPath("/logs", false); + uri.AppendQuery("api-version", "2019-10-01-preview", true); + request.Uri = uri; + return message; + } + + /// Gets deployment script logs for a given deployment script name. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The cancellation token to use. + public async ValueTask> GetLogsAsync(string resourceGroupName, string scriptName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + + using var message = CreateGetLogsRequest(resourceGroupName, scriptName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ScriptLogsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ScriptLogsList.DeserializeScriptLogsList(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets deployment script logs for a given deployment script name. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The cancellation token to use. + public Response GetLogs(string resourceGroupName, string scriptName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + + using var message = CreateGetLogsRequest(resourceGroupName, scriptName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ScriptLogsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ScriptLogsList.DeserializeScriptLogsList(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetLogsDefaultRequest(string resourceGroupName, string scriptName, int? tail) + { + 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.Resources/deploymentScripts/", false); + uri.AppendPath(scriptName, true); + uri.AppendPath("/logs/default", false); + uri.AppendQuery("api-version", "2019-10-01-preview", true); + if (tail != null) + { + uri.AppendQuery("tail", tail.Value, true); + } + request.Uri = uri; + return message; + } + + /// Gets deployment script logs for a given deployment script name. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The number of lines to show from the tail of the deployment script log. Valid value is a positive number up to 1000. If 'tail' is not provided, all available logs are shown up to container instance log capacity of 4mb. + /// The cancellation token to use. + public async ValueTask> GetLogsDefaultAsync(string resourceGroupName, string scriptName, int? tail = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + + using var message = CreateGetLogsDefaultRequest(resourceGroupName, scriptName, tail); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ScriptLog value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ScriptLog.DeserializeScriptLog(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets deployment script logs for a given deployment script name. + /// The name of the resource group. The name is case insensitive. + /// Name of the deployment script. + /// The number of lines to show from the tail of the deployment script log. Valid value is a positive number up to 1000. If 'tail' is not provided, all available logs are shown up to container instance log capacity of 4mb. + /// The cancellation token to use. + public Response GetLogsDefault(string resourceGroupName, string scriptName, int? tail = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (scriptName == null) + { + throw new ArgumentNullException(nameof(scriptName)); + } + + using var message = CreateGetLogsDefaultRequest(resourceGroupName, scriptName, tail); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ScriptLog value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ScriptLog.DeserializeScriptLog(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByResourceGroupRequest(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.Resources/deploymentScripts", false); + uri.AppendQuery("api-version", "2019-10-01-preview", true); + request.Uri = uri; + return message; + } + + /// Lists deployments scripts. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public async ValueTask> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupRequest(resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentScriptListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists deployments scripts. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public Response ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupRequest(resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentScriptListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListBySubscriptionNextPageRequest(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; + return message; + } + + /// Lists all deployment scripts for a given subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + public async ValueTask> ListBySubscriptionNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListBySubscriptionNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentScriptListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists all deployment scripts for a given subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + public Response ListBySubscriptionNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListBySubscriptionNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentScriptListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByResourceGroupNextPageRequest(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; + return message; + } + + /// Lists deployments scripts. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public async ValueTask> ListByResourceGroupNextPageAsync(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 = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentScriptListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists deployments scripts. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + public Response ListByResourceGroupNextPage(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 = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentScriptListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsClient.cs new file mode 100644 index 000000000000..69dad51ac8f2 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsClient.cs @@ -0,0 +1,2282 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The Deployments service client. + public partial class DeploymentsClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DeploymentsRestClient RestClient { get; } + /// Initializes a new instance of DeploymentsClient for mocking. + protected DeploymentsClient() + { + } + /// Initializes a new instance of DeploymentsClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal DeploymentsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DeploymentsRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Checks whether the deployment exists. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task CheckExistenceAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CheckExistenceAtScope"); + scope0.Start(); + try + { + return await RestClient.CheckExistenceAtScopeAsync(scope, deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Checks whether the deployment exists. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response CheckExistenceAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CheckExistenceAtScope"); + scope0.Start(); + try + { + return RestClient.CheckExistenceAtScope(scope, deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployment. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task> GetAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.GetAtScope"); + scope0.Start(); + try + { + return await RestClient.GetAtScopeAsync(scope, deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployment. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response GetAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.GetAtScope"); + scope0.Start(); + try + { + return RestClient.GetAtScope(scope, deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task CancelAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CancelAtScope"); + scope0.Start(); + try + { + return await RestClient.CancelAtScopeAsync(scope, deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response CancelAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CancelAtScope"); + scope0.Start(); + try + { + return RestClient.CancelAtScope(scope, deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Exports the template used for specified deployment. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task> ExportTemplateAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ExportTemplateAtScope"); + scope0.Start(); + try + { + return await RestClient.ExportTemplateAtScopeAsync(scope, deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Exports the template used for specified deployment. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response ExportTemplateAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ExportTemplateAtScope"); + scope0.Start(); + try + { + return RestClient.ExportTemplateAtScope(scope, deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Checks whether the deployment exists. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task CheckExistenceAtTenantScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CheckExistenceAtTenantScope"); + scope0.Start(); + try + { + return await RestClient.CheckExistenceAtTenantScopeAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Checks whether the deployment exists. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response CheckExistenceAtTenantScope(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CheckExistenceAtTenantScope"); + scope0.Start(); + try + { + return RestClient.CheckExistenceAtTenantScope(deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployment. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task> GetAtTenantScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.GetAtTenantScope"); + scope0.Start(); + try + { + return await RestClient.GetAtTenantScopeAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployment. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response GetAtTenantScope(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.GetAtTenantScope"); + scope0.Start(); + try + { + return RestClient.GetAtTenantScope(deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task CancelAtTenantScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CancelAtTenantScope"); + scope0.Start(); + try + { + return await RestClient.CancelAtTenantScopeAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response CancelAtTenantScope(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CancelAtTenantScope"); + scope0.Start(); + try + { + return RestClient.CancelAtTenantScope(deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Exports the template used for specified deployment. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task> ExportTemplateAtTenantScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ExportTemplateAtTenantScope"); + scope0.Start(); + try + { + return await RestClient.ExportTemplateAtTenantScopeAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Exports the template used for specified deployment. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response ExportTemplateAtTenantScope(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ExportTemplateAtTenantScope"); + scope0.Start(); + try + { + return RestClient.ExportTemplateAtTenantScope(deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Checks whether the deployment exists. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task CheckExistenceAtManagementGroupScopeAsync(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CheckExistenceAtManagementGroupScope"); + scope0.Start(); + try + { + return await RestClient.CheckExistenceAtManagementGroupScopeAsync(groupId, deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Checks whether the deployment exists. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response CheckExistenceAtManagementGroupScope(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CheckExistenceAtManagementGroupScope"); + scope0.Start(); + try + { + return RestClient.CheckExistenceAtManagementGroupScope(groupId, deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployment. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task> GetAtManagementGroupScopeAsync(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.GetAtManagementGroupScope"); + scope0.Start(); + try + { + return await RestClient.GetAtManagementGroupScopeAsync(groupId, deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployment. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response GetAtManagementGroupScope(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.GetAtManagementGroupScope"); + scope0.Start(); + try + { + return RestClient.GetAtManagementGroupScope(groupId, deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task CancelAtManagementGroupScopeAsync(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CancelAtManagementGroupScope"); + scope0.Start(); + try + { + return await RestClient.CancelAtManagementGroupScopeAsync(groupId, deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response CancelAtManagementGroupScope(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CancelAtManagementGroupScope"); + scope0.Start(); + try + { + return RestClient.CancelAtManagementGroupScope(groupId, deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Exports the template used for specified deployment. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task> ExportTemplateAtManagementGroupScopeAsync(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ExportTemplateAtManagementGroupScope"); + scope0.Start(); + try + { + return await RestClient.ExportTemplateAtManagementGroupScopeAsync(groupId, deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Exports the template used for specified deployment. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response ExportTemplateAtManagementGroupScope(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ExportTemplateAtManagementGroupScope"); + scope0.Start(); + try + { + return RestClient.ExportTemplateAtManagementGroupScope(groupId, deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Checks whether the deployment exists. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task CheckExistenceAtSubscriptionScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CheckExistenceAtSubscriptionScope"); + scope0.Start(); + try + { + return await RestClient.CheckExistenceAtSubscriptionScopeAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Checks whether the deployment exists. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response CheckExistenceAtSubscriptionScope(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CheckExistenceAtSubscriptionScope"); + scope0.Start(); + try + { + return RestClient.CheckExistenceAtSubscriptionScope(deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployment. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task> GetAtSubscriptionScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.GetAtSubscriptionScope"); + scope0.Start(); + try + { + return await RestClient.GetAtSubscriptionScopeAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployment. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response GetAtSubscriptionScope(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.GetAtSubscriptionScope"); + scope0.Start(); + try + { + return RestClient.GetAtSubscriptionScope(deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task CancelAtSubscriptionScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CancelAtSubscriptionScope"); + scope0.Start(); + try + { + return await RestClient.CancelAtSubscriptionScopeAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response CancelAtSubscriptionScope(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CancelAtSubscriptionScope"); + scope0.Start(); + try + { + return RestClient.CancelAtSubscriptionScope(deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Exports the template used for specified deployment. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task> ExportTemplateAtSubscriptionScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ExportTemplateAtSubscriptionScope"); + scope0.Start(); + try + { + return await RestClient.ExportTemplateAtSubscriptionScopeAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Exports the template used for specified deployment. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response ExportTemplateAtSubscriptionScope(string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ExportTemplateAtSubscriptionScope"); + scope0.Start(); + try + { + return RestClient.ExportTemplateAtSubscriptionScope(deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Checks whether the deployment exists. + /// The name of the resource group with the deployment to check. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task CheckExistenceAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CheckExistence"); + scope0.Start(); + try + { + return await RestClient.CheckExistenceAsync(resourceGroupName, deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Checks whether the deployment exists. + /// The name of the resource group with the deployment to check. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response CheckExistence(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CheckExistence"); + scope0.Start(); + try + { + return RestClient.CheckExistence(resourceGroupName, deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployment. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.Get"); + scope0.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a deployment. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.Get"); + scope0.Start(); + try + { + return RestClient.Get(resourceGroupName, deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task CancelAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.Cancel"); + scope0.Start(); + try + { + return await RestClient.CancelAsync(resourceGroupName, deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response Cancel(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.Cancel"); + scope0.Start(); + try + { + return RestClient.Cancel(resourceGroupName, deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Exports the template used for specified deployment. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async Task> ExportTemplateAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ExportTemplate"); + scope0.Start(); + try + { + return await RestClient.ExportTemplateAsync(resourceGroupName, deploymentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Exports the template used for specified deployment. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public virtual Response ExportTemplate(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ExportTemplate"); + scope0.Start(); + try + { + return RestClient.ExportTemplate(resourceGroupName, deploymentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Calculate the hash of the given template. + /// The template provided to calculate hash. + /// The cancellation token to use. + public virtual async Task> CalculateTemplateHashAsync(object template, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CalculateTemplateHash"); + scope0.Start(); + try + { + return await RestClient.CalculateTemplateHashAsync(template, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Calculate the hash of the given template. + /// The template provided to calculate hash. + /// The cancellation token to use. + public virtual Response CalculateTemplateHash(object template, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.CalculateTemplateHash"); + scope0.Start(); + try + { + return RestClient.CalculateTemplateHash(template, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Get all the deployments at the given scope. + /// The resource scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public virtual AsyncPageable ListAtScopeAsync(string scope, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtScopeAsync(scope, filter, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtScopeNextPageAsync(nextLink, scope, filter, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Get all the deployments at the given scope. + /// The resource scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public virtual Pageable ListAtScope(string scope, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtScope(scope, filter, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtScopeNextPage(nextLink, scope, filter, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Get all the deployments at the tenant scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public virtual AsyncPageable ListAtTenantScopeAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtTenantScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtTenantScopeAsync(filter, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtTenantScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtTenantScopeNextPageAsync(nextLink, filter, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Get all the deployments at the tenant scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public virtual Pageable ListAtTenantScope(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtTenantScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtTenantScope(filter, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtTenantScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtTenantScopeNextPage(nextLink, filter, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Get all the deployments for a management group. + /// The management group ID. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public virtual AsyncPageable ListAtManagementGroupScopeAsync(string groupId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtManagementGroupScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtManagementGroupScopeAsync(groupId, filter, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtManagementGroupScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtManagementGroupScopeNextPageAsync(nextLink, groupId, filter, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Get all the deployments for a management group. + /// The management group ID. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public virtual Pageable ListAtManagementGroupScope(string groupId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtManagementGroupScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtManagementGroupScope(groupId, filter, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtManagementGroupScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtManagementGroupScopeNextPage(nextLink, groupId, filter, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Get all the deployments for a subscription. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public virtual AsyncPageable ListAtSubscriptionScopeAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtSubscriptionScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtSubscriptionScopeAsync(filter, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtSubscriptionScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtSubscriptionScopeNextPageAsync(nextLink, filter, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Get all the deployments for a subscription. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public virtual Pageable ListAtSubscriptionScope(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtSubscriptionScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtSubscriptionScope(filter, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListAtSubscriptionScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtSubscriptionScopeNextPage(nextLink, filter, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Get all the deployments for a resource group. + /// The name of the resource group with the deployments to get. The name is case insensitive. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListByResourceGroup"); + scope0.Start(); + try + { + var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, filter, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListByResourceGroup"); + scope0.Start(); + try + { + var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, filter, top, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Get all the deployments for a resource group. + /// The name of the resource group with the deployments to get. The name is case insensitive. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public virtual Pageable ListByResourceGroup(string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListByResourceGroup"); + scope0.Start(); + try + { + var response = RestClient.ListByResourceGroup(resourceGroupName, filter, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.ListByResourceGroup"); + scope0.Start(); + try + { + var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, filter, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async ValueTask StartDeleteAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartDeleteAtScope"); + scope0.Start(); + try + { + var originalResponse = await RestClient.DeleteAtScopeAsync(scope, deploymentName, cancellationToken).ConfigureAwait(false); + return new DeploymentsDeleteAtScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteAtScopeRequest(scope, deploymentName).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public virtual DeploymentsDeleteAtScopeOperation StartDeleteAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartDeleteAtScope"); + scope0.Start(); + try + { + var originalResponse = RestClient.DeleteAtScope(scope, deploymentName, cancellationToken); + return new DeploymentsDeleteAtScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteAtScopeRequest(scope, deploymentName).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The resource scope. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public virtual async ValueTask StartCreateOrUpdateAtScopeAsync(string scope, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartCreateOrUpdateAtScope"); + scope0.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAtScopeAsync(scope, deploymentName, parameters, cancellationToken).ConfigureAwait(false); + return new DeploymentsCreateOrUpdateAtScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateAtScopeRequest(scope, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The resource scope. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public virtual DeploymentsCreateOrUpdateAtScopeOperation StartCreateOrUpdateAtScope(string scope, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartCreateOrUpdateAtScope"); + scope0.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdateAtScope(scope, deploymentName, parameters, cancellationToken); + return new DeploymentsCreateOrUpdateAtScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateAtScopeRequest(scope, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The resource scope. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public virtual async ValueTask StartValidateAtScopeAsync(string scope, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartValidateAtScope"); + scope0.Start(); + try + { + var originalResponse = await RestClient.ValidateAtScopeAsync(scope, deploymentName, parameters, cancellationToken).ConfigureAwait(false); + return new DeploymentsValidateAtScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateValidateAtScopeRequest(scope, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The resource scope. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public virtual DeploymentsValidateAtScopeOperation StartValidateAtScope(string scope, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartValidateAtScope"); + scope0.Start(); + try + { + var originalResponse = RestClient.ValidateAtScope(scope, deploymentName, parameters, cancellationToken); + return new DeploymentsValidateAtScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateValidateAtScopeRequest(scope, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async ValueTask StartDeleteAtTenantScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartDeleteAtTenantScope"); + scope0.Start(); + try + { + var originalResponse = await RestClient.DeleteAtTenantScopeAsync(deploymentName, cancellationToken).ConfigureAwait(false); + return new DeploymentsDeleteAtTenantScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteAtTenantScopeRequest(deploymentName).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The name of the deployment. + /// The cancellation token to use. + public virtual DeploymentsDeleteAtTenantScopeOperation StartDeleteAtTenantScope(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartDeleteAtTenantScope"); + scope0.Start(); + try + { + var originalResponse = RestClient.DeleteAtTenantScope(deploymentName, cancellationToken); + return new DeploymentsDeleteAtTenantScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteAtTenantScopeRequest(deploymentName).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public virtual async ValueTask StartCreateOrUpdateAtTenantScopeAsync(string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartCreateOrUpdateAtTenantScope"); + scope0.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAtTenantScopeAsync(deploymentName, parameters, cancellationToken).ConfigureAwait(false); + return new DeploymentsCreateOrUpdateAtTenantScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateAtTenantScopeRequest(deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public virtual DeploymentsCreateOrUpdateAtTenantScopeOperation StartCreateOrUpdateAtTenantScope(string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartCreateOrUpdateAtTenantScope"); + scope0.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdateAtTenantScope(deploymentName, parameters, cancellationToken); + return new DeploymentsCreateOrUpdateAtTenantScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateAtTenantScopeRequest(deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public virtual async ValueTask StartValidateAtTenantScopeAsync(string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartValidateAtTenantScope"); + scope0.Start(); + try + { + var originalResponse = await RestClient.ValidateAtTenantScopeAsync(deploymentName, parameters, cancellationToken).ConfigureAwait(false); + return new DeploymentsValidateAtTenantScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateValidateAtTenantScopeRequest(deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public virtual DeploymentsValidateAtTenantScopeOperation StartValidateAtTenantScope(string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartValidateAtTenantScope"); + scope0.Start(); + try + { + var originalResponse = RestClient.ValidateAtTenantScope(deploymentName, parameters, cancellationToken); + return new DeploymentsValidateAtTenantScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateValidateAtTenantScopeRequest(deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async ValueTask StartDeleteAtManagementGroupScopeAsync(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartDeleteAtManagementGroupScope"); + scope0.Start(); + try + { + var originalResponse = await RestClient.DeleteAtManagementGroupScopeAsync(groupId, deploymentName, cancellationToken).ConfigureAwait(false); + return new DeploymentsDeleteAtManagementGroupScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteAtManagementGroupScopeRequest(groupId, deploymentName).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public virtual DeploymentsDeleteAtManagementGroupScopeOperation StartDeleteAtManagementGroupScope(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartDeleteAtManagementGroupScope"); + scope0.Start(); + try + { + var originalResponse = RestClient.DeleteAtManagementGroupScope(groupId, deploymentName, cancellationToken); + return new DeploymentsDeleteAtManagementGroupScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteAtManagementGroupScopeRequest(groupId, deploymentName).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The management group ID. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public virtual async ValueTask StartCreateOrUpdateAtManagementGroupScopeAsync(string groupId, string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartCreateOrUpdateAtManagementGroupScope"); + scope0.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAtManagementGroupScopeAsync(groupId, deploymentName, parameters, cancellationToken).ConfigureAwait(false); + return new DeploymentsCreateOrUpdateAtManagementGroupScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateAtManagementGroupScopeRequest(groupId, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The management group ID. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public virtual DeploymentsCreateOrUpdateAtManagementGroupScopeOperation StartCreateOrUpdateAtManagementGroupScope(string groupId, string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartCreateOrUpdateAtManagementGroupScope"); + scope0.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdateAtManagementGroupScope(groupId, deploymentName, parameters, cancellationToken); + return new DeploymentsCreateOrUpdateAtManagementGroupScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateAtManagementGroupScopeRequest(groupId, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The management group ID. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public virtual async ValueTask StartValidateAtManagementGroupScopeAsync(string groupId, string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartValidateAtManagementGroupScope"); + scope0.Start(); + try + { + var originalResponse = await RestClient.ValidateAtManagementGroupScopeAsync(groupId, deploymentName, parameters, cancellationToken).ConfigureAwait(false); + return new DeploymentsValidateAtManagementGroupScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateValidateAtManagementGroupScopeRequest(groupId, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The management group ID. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public virtual DeploymentsValidateAtManagementGroupScopeOperation StartValidateAtManagementGroupScope(string groupId, string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartValidateAtManagementGroupScope"); + scope0.Start(); + try + { + var originalResponse = RestClient.ValidateAtManagementGroupScope(groupId, deploymentName, parameters, cancellationToken); + return new DeploymentsValidateAtManagementGroupScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateValidateAtManagementGroupScopeRequest(groupId, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async ValueTask StartDeleteAtSubscriptionScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartDeleteAtSubscriptionScope"); + scope0.Start(); + try + { + var originalResponse = await RestClient.DeleteAtSubscriptionScopeAsync(deploymentName, cancellationToken).ConfigureAwait(false); + return new DeploymentsDeleteAtSubscriptionScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteAtSubscriptionScopeRequest(deploymentName).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The name of the deployment. + /// The cancellation token to use. + public virtual DeploymentsDeleteAtSubscriptionScopeOperation StartDeleteAtSubscriptionScope(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartDeleteAtSubscriptionScope"); + scope0.Start(); + try + { + var originalResponse = RestClient.DeleteAtSubscriptionScope(deploymentName, cancellationToken); + return new DeploymentsDeleteAtSubscriptionScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteAtSubscriptionScopeRequest(deploymentName).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public virtual async ValueTask StartCreateOrUpdateAtSubscriptionScopeAsync(string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartCreateOrUpdateAtSubscriptionScope"); + scope0.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAtSubscriptionScopeAsync(deploymentName, parameters, cancellationToken).ConfigureAwait(false); + return new DeploymentsCreateOrUpdateAtSubscriptionScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateAtSubscriptionScopeRequest(deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public virtual DeploymentsCreateOrUpdateAtSubscriptionScopeOperation StartCreateOrUpdateAtSubscriptionScope(string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartCreateOrUpdateAtSubscriptionScope"); + scope0.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdateAtSubscriptionScope(deploymentName, parameters, cancellationToken); + return new DeploymentsCreateOrUpdateAtSubscriptionScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateAtSubscriptionScopeRequest(deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public virtual async ValueTask StartValidateAtSubscriptionScopeAsync(string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartValidateAtSubscriptionScope"); + scope0.Start(); + try + { + var originalResponse = await RestClient.ValidateAtSubscriptionScopeAsync(deploymentName, parameters, cancellationToken).ConfigureAwait(false); + return new DeploymentsValidateAtSubscriptionScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateValidateAtSubscriptionScopeRequest(deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public virtual DeploymentsValidateAtSubscriptionScopeOperation StartValidateAtSubscriptionScope(string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartValidateAtSubscriptionScope"); + scope0.Start(); + try + { + var originalResponse = RestClient.ValidateAtSubscriptionScope(deploymentName, parameters, cancellationToken); + return new DeploymentsValidateAtSubscriptionScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateValidateAtSubscriptionScopeRequest(deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Returns changes that will be made by the deployment if executed at the scope of the subscription. + /// The name of the deployment. + /// Parameters to What If. + /// The cancellation token to use. + public virtual async ValueTask StartWhatIfAtSubscriptionScopeAsync(string deploymentName, DeploymentWhatIf parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartWhatIfAtSubscriptionScope"); + scope0.Start(); + try + { + var originalResponse = await RestClient.WhatIfAtSubscriptionScopeAsync(deploymentName, parameters, cancellationToken).ConfigureAwait(false); + return new DeploymentsWhatIfAtSubscriptionScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateWhatIfAtSubscriptionScopeRequest(deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Returns changes that will be made by the deployment if executed at the scope of the subscription. + /// The name of the deployment. + /// Parameters to What If. + /// The cancellation token to use. + public virtual DeploymentsWhatIfAtSubscriptionScopeOperation StartWhatIfAtSubscriptionScope(string deploymentName, DeploymentWhatIf parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartWhatIfAtSubscriptionScope"); + scope0.Start(); + try + { + var originalResponse = RestClient.WhatIfAtSubscriptionScope(deploymentName, parameters, cancellationToken); + return new DeploymentsWhatIfAtSubscriptionScopeOperation(_clientDiagnostics, _pipeline, RestClient.CreateWhatIfAtSubscriptionScopeRequest(deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The name of the resource group with the deployment to delete. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public virtual async ValueTask StartDeleteAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartDelete"); + scope0.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, deploymentName, cancellationToken).ConfigureAwait(false); + return new DeploymentsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, deploymentName).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The name of the resource group with the deployment to delete. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public virtual DeploymentsDeleteOperation StartDelete(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartDelete"); + scope0.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, deploymentName, cancellationToken); + return new DeploymentsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, deploymentName).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public virtual async ValueTask StartCreateOrUpdateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartCreateOrUpdate"); + scope0.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, deploymentName, parameters, cancellationToken).ConfigureAwait(false); + return new DeploymentsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public virtual DeploymentsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartCreateOrUpdate"); + scope0.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, deploymentName, parameters, cancellationToken); + return new DeploymentsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The name of the resource group the template will be deployed to. The name is case insensitive. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public virtual async ValueTask StartValidateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartValidate"); + scope0.Start(); + try + { + var originalResponse = await RestClient.ValidateAsync(resourceGroupName, deploymentName, parameters, cancellationToken).ConfigureAwait(false); + return new DeploymentsValidateOperation(_clientDiagnostics, _pipeline, RestClient.CreateValidateRequest(resourceGroupName, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The name of the resource group the template will be deployed to. The name is case insensitive. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public virtual DeploymentsValidateOperation StartValidate(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartValidate"); + scope0.Start(); + try + { + var originalResponse = RestClient.Validate(resourceGroupName, deploymentName, parameters, cancellationToken); + return new DeploymentsValidateOperation(_clientDiagnostics, _pipeline, RestClient.CreateValidateRequest(resourceGroupName, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Returns changes that will be made by the deployment if executed at the scope of the resource group. + /// The name of the resource group the template will be deployed to. The name is case insensitive. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public virtual async ValueTask StartWhatIfAsync(string resourceGroupName, string deploymentName, DeploymentWhatIf parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartWhatIf"); + scope0.Start(); + try + { + var originalResponse = await RestClient.WhatIfAsync(resourceGroupName, deploymentName, parameters, cancellationToken).ConfigureAwait(false); + return new DeploymentsWhatIfOperation(_clientDiagnostics, _pipeline, RestClient.CreateWhatIfRequest(resourceGroupName, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Returns changes that will be made by the deployment if executed at the scope of the resource group. + /// The name of the resource group the template will be deployed to. The name is case insensitive. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public virtual DeploymentsWhatIfOperation StartWhatIf(string resourceGroupName, string deploymentName, DeploymentWhatIf parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope0 = _clientDiagnostics.CreateScope("DeploymentsClient.StartWhatIf"); + scope0.Start(); + try + { + var originalResponse = RestClient.WhatIf(resourceGroupName, deploymentName, parameters, cancellationToken); + return new DeploymentsWhatIfOperation(_clientDiagnostics, _pipeline, RestClient.CreateWhatIfRequest(resourceGroupName, deploymentName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateAtManagementGroupScopeOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateAtManagementGroupScopeOperation.cs new file mode 100644 index 000000000000..0606dfa145ad --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateAtManagementGroupScopeOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// You can provide the template and parameters directly in the request or link to JSON files. + public partial class DeploymentsCreateOrUpdateAtManagementGroupScopeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsCreateOrUpdateAtManagementGroupScopeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsCreateOrUpdateAtManagementGroupScopeOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DeploymentExtended 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); + + DeploymentExtended IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateAtScopeOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateAtScopeOperation.cs new file mode 100644 index 000000000000..e3073b23a2ad --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateAtScopeOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// You can provide the template and parameters directly in the request or link to JSON files. + public partial class DeploymentsCreateOrUpdateAtScopeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsCreateOrUpdateAtScopeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsCreateOrUpdateAtScopeOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DeploymentExtended 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); + + DeploymentExtended IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateAtSubscriptionScopeOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateAtSubscriptionScopeOperation.cs new file mode 100644 index 000000000000..16adec7d04f3 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateAtSubscriptionScopeOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// You can provide the template and parameters directly in the request or link to JSON files. + public partial class DeploymentsCreateOrUpdateAtSubscriptionScopeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsCreateOrUpdateAtSubscriptionScopeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsCreateOrUpdateAtSubscriptionScopeOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DeploymentExtended 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); + + DeploymentExtended IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateAtTenantScopeOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateAtTenantScopeOperation.cs new file mode 100644 index 000000000000..c75f708c5e2f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateAtTenantScopeOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// You can provide the template and parameters directly in the request or link to JSON files. + public partial class DeploymentsCreateOrUpdateAtTenantScopeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsCreateOrUpdateAtTenantScopeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsCreateOrUpdateAtTenantScopeOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DeploymentExtended 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); + + DeploymentExtended IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentsCreateOrUpdateOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateOperation.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentsCreateOrUpdateOperation.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateOperation.cs index 24745eacbe62..ae997fde3431 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentsCreateOrUpdateOperation.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsCreateOrUpdateOperation.cs @@ -12,9 +12,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// You can provide the template and parameters directly in the request or link to JSON files. public partial class DeploymentsCreateOrUpdateOperation : Operation, IOperationSource diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteAtManagementGroupScopeOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteAtManagementGroupScopeOperation.cs new file mode 100644 index 000000000000..aa63cb06f80a --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteAtManagementGroupScopeOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + public partial class DeploymentsDeleteAtManagementGroupScopeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsDeleteAtManagementGroupScopeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsDeleteAtManagementGroupScopeOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteAtScopeOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteAtScopeOperation.cs new file mode 100644 index 000000000000..5f4829f07bae --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteAtScopeOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + public partial class DeploymentsDeleteAtScopeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsDeleteAtScopeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsDeleteAtScopeOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteAtSubscriptionScopeOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteAtSubscriptionScopeOperation.cs new file mode 100644 index 000000000000..95afc466148a --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteAtSubscriptionScopeOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + public partial class DeploymentsDeleteAtSubscriptionScopeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsDeleteAtSubscriptionScopeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsDeleteAtSubscriptionScopeOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteAtTenantScopeOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteAtTenantScopeOperation.cs new file mode 100644 index 000000000000..84b80acd0f1a --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteAtTenantScopeOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + public partial class DeploymentsDeleteAtTenantScopeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsDeleteAtTenantScopeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsDeleteAtTenantScopeOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentsDeleteOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteOperation.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentsDeleteOperation.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteOperation.cs index 7bdbe184efbc..8b19e4701367 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentsDeleteOperation.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsDeleteOperation.cs @@ -12,7 +12,7 @@ using Azure.Core; using Azure.Core.Pipeline; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. public partial class DeploymentsDeleteOperation : Operation, IOperationSource diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsRestClient.cs new file mode 100644 index 000000000000..0b341a34549b --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsRestClient.cs @@ -0,0 +1,3847 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class DeploymentsRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DeploymentsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public DeploymentsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateDeleteAtScopeRequest(string scope, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask DeleteAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateDeleteAtScopeRequest(scope, deploymentName); + 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); + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public Response DeleteAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateDeleteAtScopeRequest(scope, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCheckExistenceAtScopeRequest(string scope, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Checks whether the deployment exists. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask CheckExistenceAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCheckExistenceAtScopeRequest(scope, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Checks whether the deployment exists. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public Response CheckExistenceAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCheckExistenceAtScopeRequest(scope, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateAtScopeRequest(string scope, string deploymentName, Deployment parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The resource scope. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public async ValueTask CreateOrUpdateAtScopeAsync(string scope, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtScopeRequest(scope, deploymentName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The resource scope. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public Response CreateOrUpdateAtScope(string scope, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtScopeRequest(scope, deploymentName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtScopeRequest(string scope, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets a deployment. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask> GetAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateGetAtScopeRequest(scope, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentExtended value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a deployment. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public Response GetAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateGetAtScopeRequest(scope, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentExtended value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCancelAtScopeRequest(string scope, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/cancel", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask CancelAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCancelAtScopeRequest(scope, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public Response CancelAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCancelAtScopeRequest(scope, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateValidateAtScopeRequest(string scope, string deploymentName, Deployment parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/validate", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The resource scope. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public async ValueTask ValidateAtScopeAsync(string scope, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateValidateAtScopeRequest(scope, deploymentName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The resource scope. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public Response ValidateAtScope(string scope, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateValidateAtScopeRequest(scope, deploymentName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateExportTemplateAtScopeRequest(string scope, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/exportTemplate", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Exports the template used for specified deployment. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask> ExportTemplateAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateExportTemplateAtScopeRequest(scope, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentExportResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExportResult.DeserializeDeploymentExportResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Exports the template used for specified deployment. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + public Response ExportTemplateAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateExportTemplateAtScopeRequest(scope, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentExportResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExportResult.DeserializeDeploymentExportResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtScopeRequest(string scope, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Get all the deployments at the given scope. + /// The resource scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public async ValueTask> ListAtScopeAsync(string scope, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateListAtScopeRequest(scope, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the deployments at the given scope. + /// The resource scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public Response ListAtScope(string scope, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateListAtScopeRequest(scope, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteAtTenantScopeRequest(string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask DeleteAtTenantScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateDeleteAtTenantScopeRequest(deploymentName); + 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); + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The name of the deployment. + /// The cancellation token to use. + public Response DeleteAtTenantScope(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateDeleteAtTenantScopeRequest(deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCheckExistenceAtTenantScopeRequest(string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Checks whether the deployment exists. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask CheckExistenceAtTenantScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCheckExistenceAtTenantScopeRequest(deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Checks whether the deployment exists. + /// The name of the deployment. + /// The cancellation token to use. + public Response CheckExistenceAtTenantScope(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCheckExistenceAtTenantScopeRequest(deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateAtTenantScopeRequest(string deploymentName, ScopedDeployment parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public async ValueTask CreateOrUpdateAtTenantScopeAsync(string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtTenantScopeRequest(deploymentName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public Response CreateOrUpdateAtTenantScope(string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtTenantScopeRequest(deploymentName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtTenantScopeRequest(string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets a deployment. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask> GetAtTenantScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateGetAtTenantScopeRequest(deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentExtended value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a deployment. + /// The name of the deployment. + /// The cancellation token to use. + public Response GetAtTenantScope(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateGetAtTenantScopeRequest(deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentExtended value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCancelAtTenantScopeRequest(string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/cancel", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask CancelAtTenantScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCancelAtTenantScopeRequest(deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The name of the deployment. + /// The cancellation token to use. + public Response CancelAtTenantScope(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCancelAtTenantScopeRequest(deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateValidateAtTenantScopeRequest(string deploymentName, ScopedDeployment parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/validate", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public async ValueTask ValidateAtTenantScopeAsync(string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateValidateAtTenantScopeRequest(deploymentName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public Response ValidateAtTenantScope(string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateValidateAtTenantScopeRequest(deploymentName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateExportTemplateAtTenantScopeRequest(string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/exportTemplate", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Exports the template used for specified deployment. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask> ExportTemplateAtTenantScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateExportTemplateAtTenantScopeRequest(deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentExportResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExportResult.DeserializeDeploymentExportResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Exports the template used for specified deployment. + /// The name of the deployment. + /// The cancellation token to use. + public Response ExportTemplateAtTenantScope(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateExportTemplateAtTenantScopeRequest(deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentExportResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExportResult.DeserializeDeploymentExportResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtTenantScopeRequest(string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Get all the deployments at the tenant scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public async ValueTask> ListAtTenantScopeAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + using var message = CreateListAtTenantScopeRequest(filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the deployments at the tenant scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public Response ListAtTenantScope(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + using var message = CreateListAtTenantScopeRequest(filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteAtManagementGroupScopeRequest(string groupId, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask DeleteAtManagementGroupScopeAsync(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateDeleteAtManagementGroupScopeRequest(groupId, deploymentName); + 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); + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public Response DeleteAtManagementGroupScope(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateDeleteAtManagementGroupScopeRequest(groupId, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCheckExistenceAtManagementGroupScopeRequest(string groupId, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Checks whether the deployment exists. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask CheckExistenceAtManagementGroupScopeAsync(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCheckExistenceAtManagementGroupScopeRequest(groupId, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Checks whether the deployment exists. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public Response CheckExistenceAtManagementGroupScope(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCheckExistenceAtManagementGroupScopeRequest(groupId, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateAtManagementGroupScopeRequest(string groupId, string deploymentName, ScopedDeployment parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The management group ID. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public async ValueTask CreateOrUpdateAtManagementGroupScopeAsync(string groupId, string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtManagementGroupScopeRequest(groupId, deploymentName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The management group ID. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public Response CreateOrUpdateAtManagementGroupScope(string groupId, string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtManagementGroupScopeRequest(groupId, deploymentName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtManagementGroupScopeRequest(string groupId, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets a deployment. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask> GetAtManagementGroupScopeAsync(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateGetAtManagementGroupScopeRequest(groupId, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentExtended value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a deployment. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public Response GetAtManagementGroupScope(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateGetAtManagementGroupScopeRequest(groupId, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentExtended value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCancelAtManagementGroupScopeRequest(string groupId, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/cancel", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask CancelAtManagementGroupScopeAsync(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCancelAtManagementGroupScopeRequest(groupId, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public Response CancelAtManagementGroupScope(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCancelAtManagementGroupScopeRequest(groupId, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateValidateAtManagementGroupScopeRequest(string groupId, string deploymentName, ScopedDeployment parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/validate", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The management group ID. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public async ValueTask ValidateAtManagementGroupScopeAsync(string groupId, string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateValidateAtManagementGroupScopeRequest(groupId, deploymentName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The management group ID. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public Response ValidateAtManagementGroupScope(string groupId, string deploymentName, ScopedDeployment parameters, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateValidateAtManagementGroupScopeRequest(groupId, deploymentName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateExportTemplateAtManagementGroupScopeRequest(string groupId, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/exportTemplate", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Exports the template used for specified deployment. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask> ExportTemplateAtManagementGroupScopeAsync(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateExportTemplateAtManagementGroupScopeRequest(groupId, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentExportResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExportResult.DeserializeDeploymentExportResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Exports the template used for specified deployment. + /// The management group ID. + /// The name of the deployment. + /// The cancellation token to use. + public Response ExportTemplateAtManagementGroupScope(string groupId, string deploymentName, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateExportTemplateAtManagementGroupScopeRequest(groupId, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentExportResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExportResult.DeserializeDeploymentExportResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtManagementGroupScopeRequest(string groupId, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Get all the deployments for a management group. + /// The management group ID. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public async ValueTask> ListAtManagementGroupScopeAsync(string groupId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + + using var message = CreateListAtManagementGroupScopeRequest(groupId, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the deployments for a management group. + /// The management group ID. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public Response ListAtManagementGroupScope(string groupId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + + using var message = CreateListAtManagementGroupScopeRequest(groupId, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteAtSubscriptionScopeRequest(string deploymentName) + { + 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("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask DeleteAtSubscriptionScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateDeleteAtSubscriptionScopeRequest(deploymentName); + 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); + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The name of the deployment. + /// The cancellation token to use. + public Response DeleteAtSubscriptionScope(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateDeleteAtSubscriptionScopeRequest(deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCheckExistenceAtSubscriptionScopeRequest(string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Checks whether the deployment exists. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask CheckExistenceAtSubscriptionScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCheckExistenceAtSubscriptionScopeRequest(deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Checks whether the deployment exists. + /// The name of the deployment. + /// The cancellation token to use. + public Response CheckExistenceAtSubscriptionScope(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCheckExistenceAtSubscriptionScopeRequest(deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateAtSubscriptionScopeRequest(string deploymentName, Deployment parameters) + { + 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("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public async ValueTask CreateOrUpdateAtSubscriptionScopeAsync(string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtSubscriptionScopeRequest(deploymentName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public Response CreateOrUpdateAtSubscriptionScope(string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtSubscriptionScopeRequest(deploymentName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtSubscriptionScopeRequest(string deploymentName) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets a deployment. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask> GetAtSubscriptionScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateGetAtSubscriptionScopeRequest(deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentExtended value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a deployment. + /// The name of the deployment. + /// The cancellation token to use. + public Response GetAtSubscriptionScope(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateGetAtSubscriptionScopeRequest(deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentExtended value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCancelAtSubscriptionScopeRequest(string deploymentName) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/cancel", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask CancelAtSubscriptionScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCancelAtSubscriptionScopeRequest(deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The name of the deployment. + /// The cancellation token to use. + public Response CancelAtSubscriptionScope(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCancelAtSubscriptionScopeRequest(deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateValidateAtSubscriptionScopeRequest(string deploymentName, Deployment parameters) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/validate", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public async ValueTask ValidateAtSubscriptionScopeAsync(string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateValidateAtSubscriptionScopeRequest(deploymentName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public Response ValidateAtSubscriptionScope(string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateValidateAtSubscriptionScopeRequest(deploymentName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateWhatIfAtSubscriptionScopeRequest(string deploymentName, DeploymentWhatIf parameters) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/whatIf", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Returns changes that will be made by the deployment if executed at the scope of the subscription. + /// The name of the deployment. + /// Parameters to What If. + /// The cancellation token to use. + public async ValueTask WhatIfAtSubscriptionScopeAsync(string deploymentName, DeploymentWhatIf parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateWhatIfAtSubscriptionScopeRequest(deploymentName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Returns changes that will be made by the deployment if executed at the scope of the subscription. + /// The name of the deployment. + /// Parameters to What If. + /// The cancellation token to use. + public Response WhatIfAtSubscriptionScope(string deploymentName, DeploymentWhatIf parameters, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateWhatIfAtSubscriptionScopeRequest(deploymentName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateExportTemplateAtSubscriptionScopeRequest(string deploymentName) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/exportTemplate", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Exports the template used for specified deployment. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask> ExportTemplateAtSubscriptionScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateExportTemplateAtSubscriptionScopeRequest(deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentExportResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExportResult.DeserializeDeploymentExportResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Exports the template used for specified deployment. + /// The name of the deployment. + /// The cancellation token to use. + public Response ExportTemplateAtSubscriptionScope(string deploymentName, CancellationToken cancellationToken = default) + { + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateExportTemplateAtSubscriptionScopeRequest(deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentExportResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExportResult.DeserializeDeploymentExportResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtSubscriptionScopeRequest(string filter, int? top) + { + 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.Resources/deployments/", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Get all the deployments for a subscription. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public async ValueTask> ListAtSubscriptionScopeAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + using var message = CreateListAtSubscriptionScopeRequest(filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the deployments for a subscription. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public Response ListAtSubscriptionScope(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + using var message = CreateListAtSubscriptionScopeRequest(filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteRequest(string resourceGroupName, string deploymentName) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The name of the resource group with the deployment to delete. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask DeleteAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, deploymentName); + 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); + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The name of the resource group with the deployment to delete. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public Response Delete(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCheckExistenceRequest(string resourceGroupName, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Checks whether the deployment exists. + /// The name of the resource group with the deployment to check. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask CheckExistenceAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCheckExistenceRequest(resourceGroupName, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Checks whether the deployment exists. + /// The name of the resource group with the deployment to check. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public Response CheckExistence(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCheckExistenceRequest(resourceGroupName, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string deploymentName, Deployment parameters) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public async ValueTask CreateOrUpdateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, deploymentName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + public Response CreateOrUpdate(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, deploymentName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetRequest(string resourceGroupName, string deploymentName) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets a deployment. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask> GetAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateGetRequest(resourceGroupName, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentExtended value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a deployment. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public Response Get(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateGetRequest(resourceGroupName, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentExtended value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCancelRequest(string resourceGroupName, string deploymentName) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/cancel", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask CancelAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCancelRequest(resourceGroupName, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public Response Cancel(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateCancelRequest(resourceGroupName, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateValidateRequest(string resourceGroupName, string deploymentName, Deployment parameters) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/validate", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The name of the resource group the template will be deployed to. The name is case insensitive. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public async ValueTask ValidateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateValidateRequest(resourceGroupName, deploymentName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The name of the resource group the template will be deployed to. The name is case insensitive. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public Response Validate(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateValidateRequest(resourceGroupName, deploymentName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateWhatIfRequest(string resourceGroupName, string deploymentName, DeploymentWhatIf parameters) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/whatIf", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Returns changes that will be made by the deployment if executed at the scope of the resource group. + /// The name of the resource group the template will be deployed to. The name is case insensitive. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public async ValueTask WhatIfAsync(string resourceGroupName, string deploymentName, DeploymentWhatIf parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateWhatIfRequest(resourceGroupName, deploymentName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Returns changes that will be made by the deployment if executed at the scope of the resource group. + /// The name of the resource group the template will be deployed to. The name is case insensitive. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + public Response WhatIf(string resourceGroupName, string deploymentName, DeploymentWhatIf parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateWhatIfRequest(resourceGroupName, deploymentName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateExportTemplateRequest(string resourceGroupName, string deploymentName) + { + 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.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/exportTemplate", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Exports the template used for specified deployment. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public async ValueTask> ExportTemplateAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateExportTemplateRequest(resourceGroupName, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentExportResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExportResult.DeserializeDeploymentExportResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Exports the template used for specified deployment. + /// The name of the resource group. The name is case insensitive. + /// The name of the deployment. + /// The cancellation token to use. + public Response ExportTemplate(string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (deploymentName == null) + { + throw new ArgumentNullException(nameof(deploymentName)); + } + + using var message = CreateExportTemplateRequest(resourceGroupName, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentExportResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentExportResult.DeserializeDeploymentExportResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByResourceGroupRequest(string resourceGroupName, string filter, int? top) + { + 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.Resources/deployments/", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Get all the deployments for a resource group. + /// The name of the resource group with the deployments to get. The name is case insensitive. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public async ValueTask> ListByResourceGroupAsync(string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupRequest(resourceGroupName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the deployments for a resource group. + /// The name of the resource group with the deployments to get. The name is case insensitive. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public Response ListByResourceGroup(string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupRequest(resourceGroupName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCalculateTemplateHashRequest(object template) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Resources/calculateTemplateHash", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(template); + request.Content = content; + return message; + } + + /// Calculate the hash of the given template. + /// The template provided to calculate hash. + /// The cancellation token to use. + public async ValueTask> CalculateTemplateHashAsync(object template, CancellationToken cancellationToken = default) + { + if (template == null) + { + throw new ArgumentNullException(nameof(template)); + } + + using var message = CreateCalculateTemplateHashRequest(template); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TemplateHashResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TemplateHashResult.DeserializeTemplateHashResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Calculate the hash of the given template. + /// The template provided to calculate hash. + /// The cancellation token to use. + public Response CalculateTemplateHash(object template, CancellationToken cancellationToken = default) + { + if (template == null) + { + throw new ArgumentNullException(nameof(template)); + } + + using var message = CreateCalculateTemplateHashRequest(template); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TemplateHashResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TemplateHashResult.DeserializeTemplateHashResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtScopeNextPageRequest(string nextLink, string scope, string filter, int? top) + { + 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; + return message; + } + + /// Get all the deployments at the given scope. + /// The URL to the next page of results. + /// The resource scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public async ValueTask> ListAtScopeNextPageAsync(string nextLink, string scope, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateListAtScopeNextPageRequest(nextLink, scope, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the deployments at the given scope. + /// The URL to the next page of results. + /// The resource scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public Response ListAtScopeNextPage(string nextLink, string scope, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateListAtScopeNextPageRequest(nextLink, scope, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtTenantScopeNextPageRequest(string nextLink, string filter, int? top) + { + 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; + return message; + } + + /// Get all the deployments at the tenant scope. + /// The URL to the next page of results. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public async ValueTask> ListAtTenantScopeNextPageAsync(string nextLink, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListAtTenantScopeNextPageRequest(nextLink, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the deployments at the tenant scope. + /// The URL to the next page of results. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public Response ListAtTenantScopeNextPage(string nextLink, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListAtTenantScopeNextPageRequest(nextLink, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtManagementGroupScopeNextPageRequest(string nextLink, string groupId, string filter, int? top) + { + 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; + return message; + } + + /// Get all the deployments for a management group. + /// The URL to the next page of results. + /// The management group ID. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public async ValueTask> ListAtManagementGroupScopeNextPageAsync(string nextLink, string groupId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + + using var message = CreateListAtManagementGroupScopeNextPageRequest(nextLink, groupId, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the deployments for a management group. + /// The URL to the next page of results. + /// The management group ID. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public Response ListAtManagementGroupScopeNextPage(string nextLink, string groupId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (groupId == null) + { + throw new ArgumentNullException(nameof(groupId)); + } + + using var message = CreateListAtManagementGroupScopeNextPageRequest(nextLink, groupId, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtSubscriptionScopeNextPageRequest(string nextLink, string filter, int? top) + { + 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; + return message; + } + + /// Get all the deployments for a subscription. + /// The URL to the next page of results. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public async ValueTask> ListAtSubscriptionScopeNextPageAsync(string nextLink, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListAtSubscriptionScopeNextPageRequest(nextLink, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the deployments for a subscription. + /// The URL to the next page of results. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public Response ListAtSubscriptionScopeNextPage(string nextLink, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListAtSubscriptionScopeNextPageRequest(nextLink, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName, string filter, int? top) + { + 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; + return message; + } + + /// Get all the deployments for a resource group. + /// The URL to the next page of results. + /// The name of the resource group with the deployments to get. The name is case insensitive. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public async ValueTask> ListByResourceGroupNextPageAsync(string nextLink, string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the deployments for a resource group. + /// The URL to the next page of results. + /// The name of the resource group with the deployments to get. The name is case insensitive. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + public Response ListByResourceGroupNextPage(string nextLink, string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = DeploymentListResult.DeserializeDeploymentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateAtManagementGroupScopeOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateAtManagementGroupScopeOperation.cs new file mode 100644 index 000000000000..fc995b75151c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateAtManagementGroupScopeOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + public partial class DeploymentsValidateAtManagementGroupScopeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsValidateAtManagementGroupScopeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsValidateAtManagementGroupScopeOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DeploymentValidateResult 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); + + DeploymentValidateResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentValidateResult.DeserializeDeploymentValidateResult(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentValidateResult.DeserializeDeploymentValidateResult(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateAtScopeOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateAtScopeOperation.cs new file mode 100644 index 000000000000..6fba00997ae3 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateAtScopeOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + public partial class DeploymentsValidateAtScopeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsValidateAtScopeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsValidateAtScopeOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DeploymentValidateResult 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); + + DeploymentValidateResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentValidateResult.DeserializeDeploymentValidateResult(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentValidateResult.DeserializeDeploymentValidateResult(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateAtSubscriptionScopeOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateAtSubscriptionScopeOperation.cs new file mode 100644 index 000000000000..cf2f3f6b786b --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateAtSubscriptionScopeOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + public partial class DeploymentsValidateAtSubscriptionScopeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsValidateAtSubscriptionScopeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsValidateAtSubscriptionScopeOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DeploymentValidateResult 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); + + DeploymentValidateResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentValidateResult.DeserializeDeploymentValidateResult(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentValidateResult.DeserializeDeploymentValidateResult(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateAtTenantScopeOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateAtTenantScopeOperation.cs new file mode 100644 index 000000000000..466fd003e491 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateAtTenantScopeOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + public partial class DeploymentsValidateAtTenantScopeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsValidateAtTenantScopeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsValidateAtTenantScopeOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DeploymentValidateResult 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); + + DeploymentValidateResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentValidateResult.DeserializeDeploymentValidateResult(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentValidateResult.DeserializeDeploymentValidateResult(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateOperation.cs new file mode 100644 index 000000000000..60c2105816c6 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsValidateOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + public partial class DeploymentsValidateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsValidateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsValidateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DeploymentValidateResult 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); + + DeploymentValidateResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentValidateResult.DeserializeDeploymentValidateResult(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentValidateResult.DeserializeDeploymentValidateResult(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsWhatIfAtSubscriptionScopeOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsWhatIfAtSubscriptionScopeOperation.cs new file mode 100644 index 000000000000..87ad8545f8e1 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsWhatIfAtSubscriptionScopeOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Returns changes that will be made by the deployment if executed at the scope of the subscription. + public partial class DeploymentsWhatIfAtSubscriptionScopeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsWhatIfAtSubscriptionScopeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsWhatIfAtSubscriptionScopeOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override WhatIfOperationResult 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); + + WhatIfOperationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return WhatIfOperationResult.DeserializeWhatIfOperationResult(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return WhatIfOperationResult.DeserializeWhatIfOperationResult(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsWhatIfOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsWhatIfOperation.cs new file mode 100644 index 000000000000..9c09b7d090b0 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/DeploymentsWhatIfOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Returns changes that will be made by the deployment if executed at the scope of the resource group. + public partial class DeploymentsWhatIfOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsWhatIfOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsWhatIfOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override WhatIfOperationResult 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); + + WhatIfOperationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return WhatIfOperationResult.DeserializeWhatIfOperationResult(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return WhatIfOperationResult.DeserializeWhatIfOperationResult(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/FeaturesClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/FeaturesClient.cs new file mode 100644 index 000000000000..99ce5c068de5 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/FeaturesClient.cs @@ -0,0 +1,314 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The Features service client. + public partial class FeaturesClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal FeaturesRestClient RestClient { get; } + /// Initializes a new instance of FeaturesClient for mocking. + protected FeaturesClient() + { + } + /// Initializes a new instance of FeaturesClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal FeaturesClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new FeaturesRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the preview feature with the specified name. + /// The resource provider namespace for the feature. + /// The name of the feature to get. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("FeaturesClient.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceProviderNamespace, featureName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the preview feature with the specified name. + /// The resource provider namespace for the feature. + /// The name of the feature to get. + /// The cancellation token to use. + public virtual Response Get(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("FeaturesClient.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceProviderNamespace, featureName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Registers the preview feature for the subscription. + /// The namespace of the resource provider. + /// The name of the feature to register. + /// The cancellation token to use. + public virtual async Task> RegisterAsync(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("FeaturesClient.Register"); + scope.Start(); + try + { + return await RestClient.RegisterAsync(resourceProviderNamespace, featureName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Registers the preview feature for the subscription. + /// The namespace of the resource provider. + /// The name of the feature to register. + /// The cancellation token to use. + public virtual Response Register(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("FeaturesClient.Register"); + scope.Start(); + try + { + return RestClient.Register(resourceProviderNamespace, featureName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Unregisters the preview feature for the subscription. + /// The namespace of the resource provider. + /// The name of the feature to unregister. + /// The cancellation token to use. + public virtual async Task> UnregisterAsync(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("FeaturesClient.Unregister"); + scope.Start(); + try + { + return await RestClient.UnregisterAsync(resourceProviderNamespace, featureName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Unregisters the preview feature for the subscription. + /// The namespace of the resource provider. + /// The name of the feature to unregister. + /// The cancellation token to use. + public virtual Response Unregister(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("FeaturesClient.Unregister"); + scope.Start(); + try + { + return RestClient.Unregister(resourceProviderNamespace, featureName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets all the preview features that are available through AFEC for the subscription. + /// The cancellation token to use. + public virtual AsyncPageable ListAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("FeaturesClient.ListAll"); + scope.Start(); + try + { + var response = await RestClient.ListAllAsync(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("FeaturesClient.ListAll"); + scope.Start(); + try + { + var response = await RestClient.ListAllNextPageAsync(nextLink, 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); + } + + /// Gets all the preview features that are available through AFEC for the subscription. + /// The cancellation token to use. + public virtual Pageable ListAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("FeaturesClient.ListAll"); + scope.Start(); + try + { + var response = RestClient.ListAll(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("FeaturesClient.ListAll"); + scope.Start(); + try + { + var response = RestClient.ListAllNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all the preview features in a provider namespace that are available through AFEC for the subscription. + /// The namespace of the resource provider for getting features. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("FeaturesClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(resourceProviderNamespace, 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("FeaturesClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, resourceProviderNamespace, 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); + } + + /// Gets all the preview features in a provider namespace that are available through AFEC for the subscription. + /// The namespace of the resource provider for getting features. + /// The cancellation token to use. + public virtual Pageable List(string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("FeaturesClient.List"); + scope.Start(); + try + { + var response = RestClient.List(resourceProviderNamespace, 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("FeaturesClient.List"); + scope.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, resourceProviderNamespace, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/FeaturesRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/FeaturesRestClient.cs new file mode 100644 index 000000000000..1d43a22d3d4a --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/FeaturesRestClient.cs @@ -0,0 +1,648 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class FeaturesRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of FeaturesRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public FeaturesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateListAllRequest() + { + 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.Features/features", false); + uri.AppendQuery("api-version", "2015-12-01", true); + request.Uri = uri; + return message; + } + + /// Gets all the preview features that are available through AFEC for the subscription. + /// The cancellation token to use. + public async ValueTask> ListAllAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListAllRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FeatureOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureOperationsListResult.DeserializeFeatureOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the preview features that are available through AFEC for the subscription. + /// The cancellation token to use. + public Response ListAll(CancellationToken cancellationToken = default) + { + using var message = CreateListAllRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FeatureOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureOperationsListResult.DeserializeFeatureOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListRequest(string resourceProviderNamespace) + { + 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.Features/providers/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/features", false); + uri.AppendQuery("api-version", "2015-12-01", true); + request.Uri = uri; + return message; + } + + /// Gets all the preview features in a provider namespace that are available through AFEC for the subscription. + /// The namespace of the resource provider for getting features. + /// The cancellation token to use. + public async ValueTask> ListAsync(string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + using var message = CreateListRequest(resourceProviderNamespace); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FeatureOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureOperationsListResult.DeserializeFeatureOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the preview features in a provider namespace that are available through AFEC for the subscription. + /// The namespace of the resource provider for getting features. + /// The cancellation token to use. + public Response List(string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + using var message = CreateListRequest(resourceProviderNamespace); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FeatureOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureOperationsListResult.DeserializeFeatureOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetRequest(string resourceProviderNamespace, string featureName) + { + 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.Features/providers/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/features/", false); + uri.AppendPath(featureName, true); + uri.AppendQuery("api-version", "2015-12-01", true); + request.Uri = uri; + return message; + } + + /// Gets the preview feature with the specified name. + /// The resource provider namespace for the feature. + /// The name of the feature to get. + /// The cancellation token to use. + public async ValueTask> GetAsync(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (featureName == null) + { + throw new ArgumentNullException(nameof(featureName)); + } + + using var message = CreateGetRequest(resourceProviderNamespace, featureName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FeatureResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureResult.DeserializeFeatureResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the preview feature with the specified name. + /// The resource provider namespace for the feature. + /// The name of the feature to get. + /// The cancellation token to use. + public Response Get(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (featureName == null) + { + throw new ArgumentNullException(nameof(featureName)); + } + + using var message = CreateGetRequest(resourceProviderNamespace, featureName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FeatureResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureResult.DeserializeFeatureResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateRegisterRequest(string resourceProviderNamespace, string featureName) + { + 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.Features/providers/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/features/", false); + uri.AppendPath(featureName, true); + uri.AppendPath("/register", false); + uri.AppendQuery("api-version", "2015-12-01", true); + request.Uri = uri; + return message; + } + + /// Registers the preview feature for the subscription. + /// The namespace of the resource provider. + /// The name of the feature to register. + /// The cancellation token to use. + public async ValueTask> RegisterAsync(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (featureName == null) + { + throw new ArgumentNullException(nameof(featureName)); + } + + using var message = CreateRegisterRequest(resourceProviderNamespace, featureName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FeatureResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureResult.DeserializeFeatureResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Registers the preview feature for the subscription. + /// The namespace of the resource provider. + /// The name of the feature to register. + /// The cancellation token to use. + public Response Register(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (featureName == null) + { + throw new ArgumentNullException(nameof(featureName)); + } + + using var message = CreateRegisterRequest(resourceProviderNamespace, featureName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FeatureResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureResult.DeserializeFeatureResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateUnregisterRequest(string resourceProviderNamespace, string featureName) + { + 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.Features/providers/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/features/", false); + uri.AppendPath(featureName, true); + uri.AppendPath("/unregister", false); + uri.AppendQuery("api-version", "2015-12-01", true); + request.Uri = uri; + return message; + } + + /// Unregisters the preview feature for the subscription. + /// The namespace of the resource provider. + /// The name of the feature to unregister. + /// The cancellation token to use. + public async ValueTask> UnregisterAsync(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (featureName == null) + { + throw new ArgumentNullException(nameof(featureName)); + } + + using var message = CreateUnregisterRequest(resourceProviderNamespace, featureName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FeatureResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureResult.DeserializeFeatureResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Unregisters the preview feature for the subscription. + /// The namespace of the resource provider. + /// The name of the feature to unregister. + /// The cancellation token to use. + public Response Unregister(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (featureName == null) + { + throw new ArgumentNullException(nameof(featureName)); + } + + using var message = CreateUnregisterRequest(resourceProviderNamespace, featureName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FeatureResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureResult.DeserializeFeatureResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAllNextPageRequest(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; + return message; + } + + /// Gets all the preview features that are available through AFEC for the subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + public async ValueTask> ListAllNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListAllNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FeatureOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureOperationsListResult.DeserializeFeatureOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the preview features that are available through AFEC for the subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + public Response ListAllNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListAllNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FeatureOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureOperationsListResult.DeserializeFeatureOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListNextPageRequest(string nextLink, string resourceProviderNamespace) + { + 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; + return message; + } + + /// Gets all the preview features in a provider namespace that are available through AFEC for the subscription. + /// The URL to the next page of results. + /// The namespace of the resource provider for getting features. + /// The cancellation token to use. + public async ValueTask> ListNextPageAsync(string nextLink, string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + using var message = CreateListNextPageRequest(nextLink, resourceProviderNamespace); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FeatureOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureOperationsListResult.DeserializeFeatureOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the preview features in a provider namespace that are available through AFEC for the subscription. + /// The URL to the next page of results. + /// The namespace of the resource provider for getting features. + /// The cancellation token to use. + public Response ListNextPage(string nextLink, string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + using var message = CreateListNextPageRequest(nextLink, resourceProviderNamespace); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FeatureOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = FeatureOperationsListResult.DeserializeFeatureOperationsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ManagementLocksClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ManagementLocksClient.cs new file mode 100644 index 000000000000..356aaf5736e9 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ManagementLocksClient.cs @@ -0,0 +1,902 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The ManagementLocks service client. + public partial class ManagementLocksClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ManagementLocksRestClient RestClient { get; } + /// Initializes a new instance of ManagementLocksClient for mocking. + protected ManagementLocksClient() + { + } + /// Initializes a new instance of ManagementLocksClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal ManagementLocksClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ManagementLocksRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group to lock. + /// The lock name. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. + /// The management lock parameters. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAtResourceGroupLevelAsync(string resourceGroupName, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagementLocksClient.CreateOrUpdateAtResourceGroupLevel"); + scope.Start(); + try + { + return await RestClient.CreateOrUpdateAtResourceGroupLevelAsync(resourceGroupName, lockName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group to lock. + /// The lock name. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. + /// The management lock parameters. + /// The cancellation token to use. + public virtual Response CreateOrUpdateAtResourceGroupLevel(string resourceGroupName, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagementLocksClient.CreateOrUpdateAtResourceGroupLevel"); + scope.Start(); + try + { + return RestClient.CreateOrUpdateAtResourceGroupLevel(resourceGroupName, lockName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group containing the lock. + /// The name of lock to delete. + /// The cancellation token to use. + public virtual async Task DeleteAtResourceGroupLevelAsync(string resourceGroupName, string lockName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagementLocksClient.DeleteAtResourceGroupLevel"); + scope.Start(); + try + { + return await RestClient.DeleteAtResourceGroupLevelAsync(resourceGroupName, lockName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group containing the lock. + /// The name of lock to delete. + /// The cancellation token to use. + public virtual Response DeleteAtResourceGroupLevel(string resourceGroupName, string lockName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagementLocksClient.DeleteAtResourceGroupLevel"); + scope.Start(); + try + { + return RestClient.DeleteAtResourceGroupLevel(resourceGroupName, lockName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a management lock at the resource group level. + /// The name of the locked resource group. + /// The name of the lock to get. + /// The cancellation token to use. + public virtual async Task> GetAtResourceGroupLevelAsync(string resourceGroupName, string lockName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagementLocksClient.GetAtResourceGroupLevel"); + scope.Start(); + try + { + return await RestClient.GetAtResourceGroupLevelAsync(resourceGroupName, lockName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a management lock at the resource group level. + /// The name of the locked resource group. + /// The name of the lock to get. + /// The cancellation token to use. + public virtual Response GetAtResourceGroupLevel(string resourceGroupName, string lockName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagementLocksClient.GetAtResourceGroupLevel"); + scope.Start(); + try + { + return RestClient.GetAtResourceGroupLevel(resourceGroupName, lockName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a management lock by scope. + /// The scope for the lock. When providing a scope for the assignment, use '/subscriptions/{subscriptionId}' for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' for resources. + /// The name of lock. + /// Create or update management lock parameters. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateByScopeAsync(string scope, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.CreateOrUpdateByScope"); + scope0.Start(); + try + { + return await RestClient.CreateOrUpdateByScopeAsync(scope, lockName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Create or update a management lock by scope. + /// The scope for the lock. When providing a scope for the assignment, use '/subscriptions/{subscriptionId}' for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' for resources. + /// The name of lock. + /// Create or update management lock parameters. + /// The cancellation token to use. + public virtual Response CreateOrUpdateByScope(string scope, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.CreateOrUpdateByScope"); + scope0.Start(); + try + { + return RestClient.CreateOrUpdateByScope(scope, lockName, parameters, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Delete a management lock by scope. + /// The scope for the lock. + /// The name of lock. + /// The cancellation token to use. + public virtual async Task DeleteByScopeAsync(string scope, string lockName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.DeleteByScope"); + scope0.Start(); + try + { + return await RestClient.DeleteByScopeAsync(scope, lockName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Delete a management lock by scope. + /// The scope for the lock. + /// The name of lock. + /// The cancellation token to use. + public virtual Response DeleteByScope(string scope, string lockName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.DeleteByScope"); + scope0.Start(); + try + { + return RestClient.DeleteByScope(scope, lockName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Get a management lock by scope. + /// The scope for the lock. + /// The name of lock. + /// The cancellation token to use. + public virtual async Task> GetByScopeAsync(string scope, string lockName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.GetByScope"); + scope0.Start(); + try + { + return await RestClient.GetByScopeAsync(scope, lockName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Get a management lock by scope. + /// The scope for the lock. + /// The name of lock. + /// The cancellation token to use. + public virtual Response GetByScope(string scope, string lockName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.GetByScope"); + scope0.Start(); + try + { + return RestClient.GetByScope(scope, lockName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group containing the resource to lock. + /// The resource provider namespace of the resource to lock. + /// The parent resource identity. + /// The resource type of the resource to lock. + /// The name of the resource to lock. + /// The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. + /// Parameters for creating or updating a management lock. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAtResourceLevelAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.CreateOrUpdateAtResourceLevel"); + scope0.Start(); + try + { + return await RestClient.CreateOrUpdateAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group containing the resource to lock. + /// The resource provider namespace of the resource to lock. + /// The parent resource identity. + /// The resource type of the resource to lock. + /// The name of the resource to lock. + /// The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. + /// Parameters for creating or updating a management lock. + /// The cancellation token to use. + public virtual Response CreateOrUpdateAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.CreateOrUpdateAtResourceLevel"); + scope0.Start(); + try + { + return RestClient.CreateOrUpdateAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group containing the resource with the lock to delete. + /// The resource provider namespace of the resource with the lock to delete. + /// The parent resource identity. + /// The resource type of the resource with the lock to delete. + /// The name of the resource with the lock to delete. + /// The name of the lock to delete. + /// The cancellation token to use. + public virtual async Task DeleteAtResourceLevelAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.DeleteAtResourceLevel"); + scope0.Start(); + try + { + return await RestClient.DeleteAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group containing the resource with the lock to delete. + /// The resource provider namespace of the resource with the lock to delete. + /// The parent resource identity. + /// The resource type of the resource with the lock to delete. + /// The name of the resource with the lock to delete. + /// The name of the lock to delete. + /// The cancellation token to use. + public virtual Response DeleteAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.DeleteAtResourceLevel"); + scope0.Start(); + try + { + return RestClient.DeleteAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Get the management lock of a resource or any level below resource. + /// The name of the resource group. + /// The namespace of the resource provider. + /// An extra path parameter needed in some services, like SQL Databases. + /// The type of the resource. + /// The name of the resource. + /// The name of lock. + /// The cancellation token to use. + public virtual async Task> GetAtResourceLevelAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.GetAtResourceLevel"); + scope0.Start(); + try + { + return await RestClient.GetAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Get the management lock of a resource or any level below resource. + /// The name of the resource group. + /// The namespace of the resource provider. + /// An extra path parameter needed in some services, like SQL Databases. + /// The type of the resource. + /// The name of the resource. + /// The name of lock. + /// The cancellation token to use. + public virtual Response GetAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.GetAtResourceLevel"); + scope0.Start(); + try + { + return RestClient.GetAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. + /// The management lock parameters. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAtSubscriptionLevelAsync(string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.CreateOrUpdateAtSubscriptionLevel"); + scope0.Start(); + try + { + return await RestClient.CreateOrUpdateAtSubscriptionLevelAsync(lockName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. + /// The management lock parameters. + /// The cancellation token to use. + public virtual Response CreateOrUpdateAtSubscriptionLevel(string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.CreateOrUpdateAtSubscriptionLevel"); + scope0.Start(); + try + { + return RestClient.CreateOrUpdateAtSubscriptionLevel(lockName, parameters, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of lock to delete. + /// The cancellation token to use. + public virtual async Task DeleteAtSubscriptionLevelAsync(string lockName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.DeleteAtSubscriptionLevel"); + scope0.Start(); + try + { + return await RestClient.DeleteAtSubscriptionLevelAsync(lockName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of lock to delete. + /// The cancellation token to use. + public virtual Response DeleteAtSubscriptionLevel(string lockName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.DeleteAtSubscriptionLevel"); + scope0.Start(); + try + { + return RestClient.DeleteAtSubscriptionLevel(lockName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a management lock at the subscription level. + /// The name of the lock to get. + /// The cancellation token to use. + public virtual async Task> GetAtSubscriptionLevelAsync(string lockName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.GetAtSubscriptionLevel"); + scope0.Start(); + try + { + return await RestClient.GetAtSubscriptionLevelAsync(lockName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets a management lock at the subscription level. + /// The name of the lock to get. + /// The cancellation token to use. + public virtual Response GetAtSubscriptionLevel(string lockName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.GetAtSubscriptionLevel"); + scope0.Start(); + try + { + return RestClient.GetAtSubscriptionLevel(lockName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets all the management locks for a resource group. + /// The name of the resource group containing the locks to get. + /// The filter to apply on the operation. + /// The cancellation token to use. + public virtual AsyncPageable ListAtResourceGroupLevelAsync(string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListAtResourceGroupLevel"); + scope0.Start(); + try + { + var response = await RestClient.ListAtResourceGroupLevelAsync(resourceGroupName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListAtResourceGroupLevel"); + scope0.Start(); + try + { + var response = await RestClient.ListAtResourceGroupLevelNextPageAsync(nextLink, resourceGroupName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all the management locks for a resource group. + /// The name of the resource group containing the locks to get. + /// The filter to apply on the operation. + /// The cancellation token to use. + public virtual Pageable ListAtResourceGroupLevel(string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListAtResourceGroupLevel"); + scope0.Start(); + try + { + var response = RestClient.ListAtResourceGroupLevel(resourceGroupName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListAtResourceGroupLevel"); + scope0.Start(); + try + { + var response = RestClient.ListAtResourceGroupLevelNextPage(nextLink, resourceGroupName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all the management locks for a resource or any level below resource. + /// The name of the resource group containing the locked resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the locked resource. + /// The name of the locked resource. + /// The filter to apply on the operation. + /// The cancellation token to use. + public virtual AsyncPageable ListAtResourceLevelAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListAtResourceLevel"); + scope0.Start(); + try + { + var response = await RestClient.ListAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListAtResourceLevel"); + scope0.Start(); + try + { + var response = await RestClient.ListAtResourceLevelNextPageAsync(nextLink, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all the management locks for a resource or any level below resource. + /// The name of the resource group containing the locked resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the locked resource. + /// The name of the locked resource. + /// The filter to apply on the operation. + /// The cancellation token to use. + public virtual Pageable ListAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListAtResourceLevel"); + scope0.Start(); + try + { + var response = RestClient.ListAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListAtResourceLevel"); + scope0.Start(); + try + { + var response = RestClient.ListAtResourceLevelNextPage(nextLink, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all the management locks for a subscription. + /// The filter to apply on the operation. + /// The cancellation token to use. + public virtual AsyncPageable ListAtSubscriptionLevelAsync(string filter = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListAtSubscriptionLevel"); + scope0.Start(); + try + { + var response = await RestClient.ListAtSubscriptionLevelAsync(filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListAtSubscriptionLevel"); + scope0.Start(); + try + { + var response = await RestClient.ListAtSubscriptionLevelNextPageAsync(nextLink, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all the management locks for a subscription. + /// The filter to apply on the operation. + /// The cancellation token to use. + public virtual Pageable ListAtSubscriptionLevel(string filter = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListAtSubscriptionLevel"); + scope0.Start(); + try + { + var response = RestClient.ListAtSubscriptionLevel(filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListAtSubscriptionLevel"); + scope0.Start(); + try + { + var response = RestClient.ListAtSubscriptionLevelNextPage(nextLink, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all the management locks for a scope. + /// The scope for the lock. When providing a scope for the assignment, use '/subscriptions/{subscriptionId}' for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' for resources. + /// The filter to apply on the operation. + /// The cancellation token to use. + public virtual AsyncPageable ListByScopeAsync(string scope, string filter = null, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListByScope"); + scope0.Start(); + try + { + var response = await RestClient.ListByScopeAsync(scope, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListByScope"); + scope0.Start(); + try + { + var response = await RestClient.ListByScopeNextPageAsync(nextLink, scope, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all the management locks for a scope. + /// The scope for the lock. When providing a scope for the assignment, use '/subscriptions/{subscriptionId}' for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' for resources. + /// The filter to apply on the operation. + /// The cancellation token to use. + public virtual Pageable ListByScope(string scope, string filter = null, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListByScope"); + scope0.Start(); + try + { + var response = RestClient.ListByScope(scope, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksClient.ListByScope"); + scope0.Start(); + try + { + var response = RestClient.ListByScopeNextPage(nextLink, scope, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ManagementLocksRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ManagementLocksRestClient.cs new file mode 100644 index 000000000000..a1c0fa7eeb36 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ManagementLocksRestClient.cs @@ -0,0 +1,2030 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class ManagementLocksRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ManagementLocksRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public ManagementLocksRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateCreateOrUpdateAtResourceGroupLevelRequest(string resourceGroupName, string lockName, ManagementLockObject parameters) + { + 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.Authorization/locks/", false); + uri.AppendPath(lockName, true); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group to lock. + /// The lock name. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. + /// The management lock parameters. + /// The cancellation token to use. + public async ValueTask> CreateOrUpdateAtResourceGroupLevelAsync(string resourceGroupName, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtResourceGroupLevelRequest(resourceGroupName, lockName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ManagementLockObject value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group to lock. + /// The lock name. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. + /// The management lock parameters. + /// The cancellation token to use. + public Response CreateOrUpdateAtResourceGroupLevel(string resourceGroupName, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtResourceGroupLevelRequest(resourceGroupName, lockName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ManagementLockObject value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteAtResourceGroupLevelRequest(string resourceGroupName, string lockName) + { + 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.Authorization/locks/", false); + uri.AppendPath(lockName, true); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group containing the lock. + /// The name of lock to delete. + /// The cancellation token to use. + public async ValueTask DeleteAtResourceGroupLevelAsync(string resourceGroupName, string lockName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateDeleteAtResourceGroupLevelRequest(resourceGroupName, lockName); + 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); + } + } + + /// To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group containing the lock. + /// The name of lock to delete. + /// The cancellation token to use. + public Response DeleteAtResourceGroupLevel(string resourceGroupName, string lockName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateDeleteAtResourceGroupLevelRequest(resourceGroupName, lockName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtResourceGroupLevelRequest(string resourceGroupName, string lockName) + { + 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.Authorization/locks/", false); + uri.AppendPath(lockName, true); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Gets a management lock at the resource group level. + /// The name of the locked resource group. + /// The name of the lock to get. + /// The cancellation token to use. + public async ValueTask> GetAtResourceGroupLevelAsync(string resourceGroupName, string lockName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateGetAtResourceGroupLevelRequest(resourceGroupName, lockName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagementLockObject value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a management lock at the resource group level. + /// The name of the locked resource group. + /// The name of the lock to get. + /// The cancellation token to use. + public Response GetAtResourceGroupLevel(string resourceGroupName, string lockName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateGetAtResourceGroupLevelRequest(resourceGroupName, lockName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagementLockObject value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateByScopeRequest(string scope, string lockName, ManagementLockObject parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, true); + uri.AppendPath("/providers/Microsoft.Authorization/locks/", false); + uri.AppendPath(lockName, true); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Create or update a management lock by scope. + /// The scope for the lock. When providing a scope for the assignment, use '/subscriptions/{subscriptionId}' for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' for resources. + /// The name of lock. + /// Create or update management lock parameters. + /// The cancellation token to use. + public async ValueTask> CreateOrUpdateByScopeAsync(string scope, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateByScopeRequest(scope, lockName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ManagementLockObject value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a management lock by scope. + /// The scope for the lock. When providing a scope for the assignment, use '/subscriptions/{subscriptionId}' for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' for resources. + /// The name of lock. + /// Create or update management lock parameters. + /// The cancellation token to use. + public Response CreateOrUpdateByScope(string scope, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateByScopeRequest(scope, lockName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ManagementLockObject value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteByScopeRequest(string scope, string lockName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, true); + uri.AppendPath("/providers/Microsoft.Authorization/locks/", false); + uri.AppendPath(lockName, true); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Delete a management lock by scope. + /// The scope for the lock. + /// The name of lock. + /// The cancellation token to use. + public async ValueTask DeleteByScopeAsync(string scope, string lockName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateDeleteByScopeRequest(scope, lockName); + 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 a management lock by scope. + /// The scope for the lock. + /// The name of lock. + /// The cancellation token to use. + public Response DeleteByScope(string scope, string lockName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateDeleteByScopeRequest(scope, lockName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetByScopeRequest(string scope, string lockName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, true); + uri.AppendPath("/providers/Microsoft.Authorization/locks/", false); + uri.AppendPath(lockName, true); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Get a management lock by scope. + /// The scope for the lock. + /// The name of lock. + /// The cancellation token to use. + public async ValueTask> GetByScopeAsync(string scope, string lockName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateGetByScopeRequest(scope, lockName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagementLockObject value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a management lock by scope. + /// The scope for the lock. + /// The name of lock. + /// The cancellation token to use. + public Response GetByScope(string scope, string lockName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateGetByScopeRequest(scope, lockName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagementLockObject value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateAtResourceLevelRequest(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObject parameters) + { + 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/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/", false); + uri.AppendPath(parentResourcePath, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceType, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.Authorization/locks/", false); + uri.AppendPath(lockName, true); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group containing the resource to lock. + /// The resource provider namespace of the resource to lock. + /// The parent resource identity. + /// The resource type of the resource to lock. + /// The name of the resource to lock. + /// The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. + /// Parameters for creating or updating a management lock. + /// The cancellation token to use. + public async ValueTask> CreateOrUpdateAtResourceLevelAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ManagementLockObject value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group containing the resource to lock. + /// The resource provider namespace of the resource to lock. + /// The parent resource identity. + /// The resource type of the resource to lock. + /// The name of the resource to lock. + /// The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. + /// Parameters for creating or updating a management lock. + /// The cancellation token to use. + public Response CreateOrUpdateAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ManagementLockObject value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteAtResourceLevelRequest(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName) + { + 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/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/", false); + uri.AppendPath(parentResourcePath, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceType, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.Authorization/locks/", false); + uri.AppendPath(lockName, true); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group containing the resource with the lock to delete. + /// The resource provider namespace of the resource with the lock to delete. + /// The parent resource identity. + /// The resource type of the resource with the lock to delete. + /// The name of the resource with the lock to delete. + /// The name of the lock to delete. + /// The cancellation token to use. + public async ValueTask DeleteAtResourceLevelAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateDeleteAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName); + 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); + } + } + + /// To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of the resource group containing the resource with the lock to delete. + /// The resource provider namespace of the resource with the lock to delete. + /// The parent resource identity. + /// The resource type of the resource with the lock to delete. + /// The name of the resource with the lock to delete. + /// The name of the lock to delete. + /// The cancellation token to use. + public Response DeleteAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateDeleteAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtResourceLevelRequest(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName) + { + 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/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/", false); + uri.AppendPath(parentResourcePath, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceType, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.Authorization/locks/", false); + uri.AppendPath(lockName, true); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Get the management lock of a resource or any level below resource. + /// The name of the resource group. + /// The namespace of the resource provider. + /// An extra path parameter needed in some services, like SQL Databases. + /// The type of the resource. + /// The name of the resource. + /// The name of lock. + /// The cancellation token to use. + public async ValueTask> GetAtResourceLevelAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateGetAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagementLockObject value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get the management lock of a resource or any level below resource. + /// The name of the resource group. + /// The namespace of the resource provider. + /// An extra path parameter needed in some services, like SQL Databases. + /// The type of the resource. + /// The name of the resource. + /// The name of lock. + /// The cancellation token to use. + public Response GetAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateGetAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagementLockObject value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateAtSubscriptionLevelRequest(string lockName, ManagementLockObject parameters) + { + 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("/providers/Microsoft.Authorization/locks/", false); + uri.AppendPath(lockName, true); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. + /// The management lock parameters. + /// The cancellation token to use. + public async ValueTask> CreateOrUpdateAtSubscriptionLevelAsync(string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtSubscriptionLevelRequest(lockName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ManagementLockObject value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. + /// The management lock parameters. + /// The cancellation token to use. + public Response CreateOrUpdateAtSubscriptionLevel(string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default) + { + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtSubscriptionLevelRequest(lockName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ManagementLockObject value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteAtSubscriptionLevelRequest(string lockName) + { + 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("/providers/Microsoft.Authorization/locks/", false); + uri.AppendPath(lockName, true); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of lock to delete. + /// The cancellation token to use. + public async ValueTask DeleteAtSubscriptionLevelAsync(string lockName, CancellationToken cancellationToken = default) + { + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateDeleteAtSubscriptionLevelRequest(lockName); + 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); + } + } + + /// To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. + /// The name of lock to delete. + /// The cancellation token to use. + public Response DeleteAtSubscriptionLevel(string lockName, CancellationToken cancellationToken = default) + { + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateDeleteAtSubscriptionLevelRequest(lockName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtSubscriptionLevelRequest(string lockName) + { + 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.Authorization/locks/", false); + uri.AppendPath(lockName, true); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Gets a management lock at the subscription level. + /// The name of the lock to get. + /// The cancellation token to use. + public async ValueTask> GetAtSubscriptionLevelAsync(string lockName, CancellationToken cancellationToken = default) + { + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateGetAtSubscriptionLevelRequest(lockName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagementLockObject value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a management lock at the subscription level. + /// The name of the lock to get. + /// The cancellation token to use. + public Response GetAtSubscriptionLevel(string lockName, CancellationToken cancellationToken = default) + { + if (lockName == null) + { + throw new ArgumentNullException(nameof(lockName)); + } + + using var message = CreateGetAtSubscriptionLevelRequest(lockName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagementLockObject value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtResourceGroupLevelRequest(string resourceGroupName, string filter) + { + 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.Authorization/locks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Gets all the management locks for a resource group. + /// The name of the resource group containing the locks to get. + /// The filter to apply on the operation. + /// The cancellation token to use. + public async ValueTask> ListAtResourceGroupLevelAsync(string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListAtResourceGroupLevelRequest(resourceGroupName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the management locks for a resource group. + /// The name of the resource group containing the locks to get. + /// The filter to apply on the operation. + /// The cancellation token to use. + public Response ListAtResourceGroupLevel(string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListAtResourceGroupLevelRequest(resourceGroupName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtResourceLevelRequest(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter) + { + 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/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/", false); + uri.AppendPath(parentResourcePath, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceType, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.Authorization/locks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Gets all the management locks for a resource or any level below resource. + /// The name of the resource group containing the locked resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the locked resource. + /// The name of the locked resource. + /// The filter to apply on the operation. + /// The cancellation token to use. + public async ValueTask> ListAtResourceLevelAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + + using var message = CreateListAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the management locks for a resource or any level below resource. + /// The name of the resource group containing the locked resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the locked resource. + /// The name of the locked resource. + /// The filter to apply on the operation. + /// The cancellation token to use. + public Response ListAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + + using var message = CreateListAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtSubscriptionLevelRequest(string filter) + { + 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.Authorization/locks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Gets all the management locks for a subscription. + /// The filter to apply on the operation. + /// The cancellation token to use. + public async ValueTask> ListAtSubscriptionLevelAsync(string filter = null, CancellationToken cancellationToken = default) + { + using var message = CreateListAtSubscriptionLevelRequest(filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the management locks for a subscription. + /// The filter to apply on the operation. + /// The cancellation token to use. + public Response ListAtSubscriptionLevel(string filter = null, CancellationToken cancellationToken = default) + { + using var message = CreateListAtSubscriptionLevelRequest(filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByScopeRequest(string scope, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, true); + uri.AppendPath("/providers/Microsoft.Authorization/locks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Gets all the management locks for a scope. + /// The scope for the lock. When providing a scope for the assignment, use '/subscriptions/{subscriptionId}' for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' for resources. + /// The filter to apply on the operation. + /// The cancellation token to use. + public async ValueTask> ListByScopeAsync(string scope, string filter = null, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateListByScopeRequest(scope, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the management locks for a scope. + /// The scope for the lock. When providing a scope for the assignment, use '/subscriptions/{subscriptionId}' for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' for resources. + /// The filter to apply on the operation. + /// The cancellation token to use. + public Response ListByScope(string scope, string filter = null, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateListByScopeRequest(scope, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtResourceGroupLevelNextPageRequest(string nextLink, string resourceGroupName, string filter) + { + 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; + return message; + } + + /// Gets all the management locks for a resource group. + /// The URL to the next page of results. + /// The name of the resource group containing the locks to get. + /// The filter to apply on the operation. + /// The cancellation token to use. + public async ValueTask> ListAtResourceGroupLevelNextPageAsync(string nextLink, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListAtResourceGroupLevelNextPageRequest(nextLink, resourceGroupName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the management locks for a resource group. + /// The URL to the next page of results. + /// The name of the resource group containing the locks to get. + /// The filter to apply on the operation. + /// The cancellation token to use. + public Response ListAtResourceGroupLevelNextPage(string nextLink, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListAtResourceGroupLevelNextPageRequest(nextLink, resourceGroupName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtResourceLevelNextPageRequest(string nextLink, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter) + { + 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; + return message; + } + + /// Gets all the management locks for a resource or any level below resource. + /// The URL to the next page of results. + /// The name of the resource group containing the locked resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the locked resource. + /// The name of the locked resource. + /// The filter to apply on the operation. + /// The cancellation token to use. + public async ValueTask> ListAtResourceLevelNextPageAsync(string nextLink, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + + using var message = CreateListAtResourceLevelNextPageRequest(nextLink, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the management locks for a resource or any level below resource. + /// The URL to the next page of results. + /// The name of the resource group containing the locked resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the locked resource. + /// The name of the locked resource. + /// The filter to apply on the operation. + /// The cancellation token to use. + public Response ListAtResourceLevelNextPage(string nextLink, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + + using var message = CreateListAtResourceLevelNextPageRequest(nextLink, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtSubscriptionLevelNextPageRequest(string nextLink, string filter) + { + 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; + return message; + } + + /// Gets all the management locks for a subscription. + /// The URL to the next page of results. + /// The filter to apply on the operation. + /// The cancellation token to use. + public async ValueTask> ListAtSubscriptionLevelNextPageAsync(string nextLink, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListAtSubscriptionLevelNextPageRequest(nextLink, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the management locks for a subscription. + /// The URL to the next page of results. + /// The filter to apply on the operation. + /// The cancellation token to use. + public Response ListAtSubscriptionLevelNextPage(string nextLink, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListAtSubscriptionLevelNextPageRequest(nextLink, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByScopeNextPageRequest(string nextLink, string scope, string filter) + { + 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; + return message; + } + + /// Gets all the management locks for a scope. + /// The URL to the next page of results. + /// The scope for the lock. When providing a scope for the assignment, use '/subscriptions/{subscriptionId}' for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' for resources. + /// The filter to apply on the operation. + /// The cancellation token to use. + public async ValueTask> ListByScopeNextPageAsync(string nextLink, string scope, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateListByScopeNextPageRequest(nextLink, scope, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the management locks for a scope. + /// The URL to the next page of results. + /// The scope for the lock. When providing a scope for the assignment, use '/subscriptions/{subscriptionId}' for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' for resources. + /// The filter to apply on the operation. + /// The cancellation token to use. + public Response ListByScopeNextPage(string nextLink, string scope, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateListByScopeNextPageRequest(nextLink, scope, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagementLockListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Alias.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Alias.Serialization.cs new file mode 100644 index 000000000000..8ed8b09248e5 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Alias.Serialization.cs @@ -0,0 +1,86 @@ +// 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.Management.Resources.Models +{ + public partial class Alias + { + internal static Alias DeserializeAlias(JsonElement element) + { + string name = default; + IReadOnlyList paths = default; + AliasType? type = default; + string defaultPath = default; + AliasPattern defaultPattern = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("paths")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(AliasPath.DeserializeAliasPath(item)); + } + } + paths = array; + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString().ToAliasType(); + continue; + } + if (property.NameEquals("defaultPath")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultPattern")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultPattern = AliasPattern.DeserializeAliasPattern(property.Value); + continue; + } + } + return new Alias(name, paths, type, defaultPath, defaultPattern); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Alias.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Alias.cs new file mode 100644 index 000000000000..c54970e26be1 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Alias.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// The alias type. + public partial class Alias + { + /// Initializes a new instance of Alias. + internal Alias() + { + } + + /// Initializes a new instance of Alias. + /// The alias name. + /// The paths for an alias. + /// The type of the alias. + /// The default path for an alias. + /// The default pattern for an alias. + internal Alias(string name, IReadOnlyList paths, AliasType? type, string defaultPath, AliasPattern defaultPattern) + { + Name = name; + Paths = paths; + Type = type; + DefaultPath = defaultPath; + DefaultPattern = defaultPattern; + } + + /// The alias name. + public string Name { get; } + /// The paths for an alias. + public IReadOnlyList Paths { get; } + /// The type of the alias. + public AliasType? Type { get; } + /// The default path for an alias. + public string DefaultPath { get; } + /// The default pattern for an alias. + public AliasPattern DefaultPattern { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPath.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPath.Serialization.cs new file mode 100644 index 000000000000..47c9cf4c7b00 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPath.Serialization.cs @@ -0,0 +1,66 @@ +// 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.Management.Resources.Models +{ + public partial class AliasPath + { + internal static AliasPath DeserializeAliasPath(JsonElement element) + { + string path = default; + IReadOnlyList apiVersions = default; + AliasPattern pattern = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("path")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + path = property.Value.GetString(); + continue; + } + if (property.NameEquals("apiVersions")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + apiVersions = array; + continue; + } + if (property.NameEquals("pattern")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pattern = AliasPattern.DeserializeAliasPattern(property.Value); + continue; + } + } + return new AliasPath(path, apiVersions, pattern); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPath.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPath.cs new file mode 100644 index 000000000000..da3bb89590dd --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPath.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// The type of the paths for alias. + public partial class AliasPath + { + /// Initializes a new instance of AliasPath. + internal AliasPath() + { + } + + /// Initializes a new instance of AliasPath. + /// The path of an alias. + /// The API versions. + /// The pattern for an alias path. + internal AliasPath(string path, IReadOnlyList apiVersions, AliasPattern pattern) + { + Path = path; + ApiVersions = apiVersions; + Pattern = pattern; + } + + /// The path of an alias. + public string Path { get; } + /// The API versions. + public IReadOnlyList ApiVersions { get; } + /// The pattern for an alias path. + public AliasPattern Pattern { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPattern.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPattern.Serialization.cs new file mode 100644 index 000000000000..38e25dc00d74 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPattern.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.Management.Resources.Models +{ + public partial class AliasPattern + { + internal static AliasPattern DeserializeAliasPattern(JsonElement element) + { + string phrase = default; + string variable = default; + AliasPatternType? type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("phrase")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + phrase = property.Value.GetString(); + continue; + } + if (property.NameEquals("variable")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + variable = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString().ToAliasPatternType(); + continue; + } + } + return new AliasPattern(phrase, variable, type); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPattern.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPattern.cs new file mode 100644 index 000000000000..caa1ea3a88b8 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPattern.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The type of the pattern for an alias path. + public partial class AliasPattern + { + /// Initializes a new instance of AliasPattern. + internal AliasPattern() + { + } + + /// Initializes a new instance of AliasPattern. + /// The alias pattern phrase. + /// The alias pattern variable. + /// The type of alias pattern. + internal AliasPattern(string phrase, string variable, AliasPatternType? type) + { + Phrase = phrase; + Variable = variable; + Type = type; + } + + /// The alias pattern phrase. + public string Phrase { get; } + /// The alias pattern variable. + public string Variable { get; } + /// The type of alias pattern. + public AliasPatternType? Type { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPatternType.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPatternType.Serialization.cs new file mode 100644 index 000000000000..d0ca72c625c1 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPatternType.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class AliasPatternTypeExtensions + { + public static string ToSerialString(this AliasPatternType value) => value switch + { + AliasPatternType.NotSpecified => "NotSpecified", + AliasPatternType.Extract => "Extract", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AliasPatternType value.") + }; + + public static AliasPatternType ToAliasPatternType(this string value) + { + if (string.Equals(value, "NotSpecified", StringComparison.InvariantCultureIgnoreCase)) return AliasPatternType.NotSpecified; + if (string.Equals(value, "Extract", StringComparison.InvariantCultureIgnoreCase)) return AliasPatternType.Extract; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AliasPatternType value."); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPatternType.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPatternType.cs new file mode 100644 index 000000000000..6988fab83054 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasPatternType.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The type of alias pattern. + public enum AliasPatternType + { + /// NotSpecified is not allowed. + NotSpecified, + /// Extract is the only allowed value. + Extract + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasType.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasType.Serialization.cs new file mode 100644 index 000000000000..86e9a01bbb80 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasType.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class AliasTypeExtensions + { + public static string ToSerialString(this AliasType value) => value switch + { + AliasType.NotSpecified => "NotSpecified", + AliasType.PlainText => "PlainText", + AliasType.Mask => "Mask", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AliasType value.") + }; + + public static AliasType ToAliasType(this string value) + { + if (string.Equals(value, "NotSpecified", StringComparison.InvariantCultureIgnoreCase)) return AliasType.NotSpecified; + if (string.Equals(value, "PlainText", StringComparison.InvariantCultureIgnoreCase)) return AliasType.PlainText; + if (string.Equals(value, "Mask", StringComparison.InvariantCultureIgnoreCase)) return AliasType.Mask; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AliasType value."); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasType.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasType.cs new file mode 100644 index 000000000000..ac438b7262a1 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AliasType.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The type of the alias. + public enum AliasType + { + /// Alias type is unknown (same as not providing alias type). + NotSpecified, + /// Alias value is not secret. + PlainText, + /// Alias value is secret. + Mask + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Application.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Application.Serialization.cs new file mode 100644 index 000000000000..1ec84d06c0bc --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Application.Serialization.cs @@ -0,0 +1,269 @@ +// 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.Management.Resources.Models +{ + public partial class Application : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Plan != null) + { + writer.WritePropertyName("plan"); + writer.WriteObjectValue(Plan); + } + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind); + if (ManagedBy != null) + { + writer.WritePropertyName("managedBy"); + writer.WriteStringValue(ManagedBy); + } + if (Sku != null) + { + writer.WritePropertyName("sku"); + writer.WriteObjectValue(Sku); + } + if (Identity != null) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + if (Location != null) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WritePropertyName("managedResourceGroupId"); + writer.WriteStringValue(ManagedResourceGroupId); + if (ApplicationDefinitionId != null) + { + writer.WritePropertyName("applicationDefinitionId"); + writer.WriteStringValue(ApplicationDefinitionId); + } + if (Parameters != null) + { + writer.WritePropertyName("parameters"); + writer.WriteObjectValue(Parameters); + } + if (Outputs != null) + { + writer.WritePropertyName("outputs"); + writer.WriteObjectValue(Outputs); + } + if (ProvisioningState != null) + { + writer.WritePropertyName("provisioningState"); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static Application DeserializeApplication(JsonElement element) + { + PlanAutoGenerated plan = default; + string kind = default; + string managedBy = default; + SkuAutoGenerated sku = default; + IdentityAutoGenerated2 identity = default; + string id = default; + string name = default; + string type = default; + string location = default; + IDictionary tags = default; + string managedResourceGroupId = default; + string applicationDefinitionId = default; + object parameters = default; + object outputs = default; + ProvisioningState? provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("plan")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + plan = PlanAutoGenerated.DeserializePlanAutoGenerated(property.Value); + continue; + } + if (property.NameEquals("kind")) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("managedBy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("sku")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = SkuAutoGenerated.DeserializeSkuAutoGenerated(property.Value); + continue; + } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = IdentityAutoGenerated2.DeserializeIdentityAutoGenerated2(property.Value); + continue; + } + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("managedResourceGroupId")) + { + managedResourceGroupId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("applicationDefinitionId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationDefinitionId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("parameters")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = property0.Value.GetObject(); + continue; + } + if (property0.NameEquals("outputs")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + outputs = property0.Value.GetObject(); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new Application(id, name, type, location, tags, managedBy, sku, identity, plan, kind, managedResourceGroupId, applicationDefinitionId, parameters, outputs, provisioningState); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Application.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Application.cs new file mode 100644 index 000000000000..f0e716b1eaef --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Application.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Information about managed application. + public partial class Application : GenericResourceAutoGenerated + { + /// Initializes a new instance of Application. + /// The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + /// The managed resource group Id. + public Application(string kind, string managedResourceGroupId) + { + if (kind == null) + { + throw new ArgumentNullException(nameof(kind)); + } + if (managedResourceGroupId == null) + { + throw new ArgumentNullException(nameof(managedResourceGroupId)); + } + + Kind = kind; + ManagedResourceGroupId = managedResourceGroupId; + } + + /// Initializes a new instance of Application. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// ID of the resource that manages this resource. + /// The SKU of the resource. + /// The identity of the resource. + /// The plan information. + /// The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + /// The managed resource group Id. + /// The fully qualified path of managed application definition Id. + /// Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string. + /// Name and value pairs that define the managed application outputs. + /// The managed application provisioning state. + internal Application(string id, string name, string type, string location, IDictionary tags, string managedBy, SkuAutoGenerated sku, IdentityAutoGenerated2 identity, PlanAutoGenerated plan, string kind, string managedResourceGroupId, string applicationDefinitionId, object parameters, object outputs, ProvisioningState? provisioningState) : base(id, name, type, location, tags, managedBy, sku, identity) + { + Plan = plan; + Kind = kind; + ManagedResourceGroupId = managedResourceGroupId; + ApplicationDefinitionId = applicationDefinitionId; + Parameters = parameters; + Outputs = outputs; + ProvisioningState = provisioningState; + } + + /// The plan information. + public PlanAutoGenerated Plan { get; set; } + /// The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + public string Kind { get; set; } + /// The managed resource group Id. + public string ManagedResourceGroupId { get; set; } + /// The fully qualified path of managed application definition Id. + public string ApplicationDefinitionId { get; set; } + /// Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string. + public object Parameters { get; set; } + /// Name and value pairs that define the managed application outputs. + public object Outputs { get; } + /// The managed application provisioning state. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationArtifact.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationArtifact.Serialization.cs new file mode 100644 index 000000000000..e186d43af60a --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationArtifact.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ApplicationArtifact : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Uri != null) + { + writer.WritePropertyName("uri"); + writer.WriteStringValue(Uri); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.Value.ToSerialString()); + } + writer.WriteEndObject(); + } + + internal static ApplicationArtifact DeserializeApplicationArtifact(JsonElement element) + { + string name = default; + string uri = default; + ApplicationArtifactType? type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("uri")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uri = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString().ToApplicationArtifactType(); + continue; + } + } + return new ApplicationArtifact(name, uri, type); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationArtifact.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationArtifact.cs new file mode 100644 index 000000000000..39907830eac8 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationArtifact.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Managed application artifact. + public partial class ApplicationArtifact + { + /// Initializes a new instance of ApplicationArtifact. + public ApplicationArtifact() + { + } + + /// Initializes a new instance of ApplicationArtifact. + /// The managed application artifact name. + /// The managed application artifact blob uri. + /// The managed application artifact type. + internal ApplicationArtifact(string name, string uri, ApplicationArtifactType? type) + { + Name = name; + Uri = uri; + Type = type; + } + + /// The managed application artifact name. + public string Name { get; set; } + /// The managed application artifact blob uri. + public string Uri { get; set; } + /// The managed application artifact type. + public ApplicationArtifactType? Type { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationArtifactType.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationArtifactType.Serialization.cs new file mode 100644 index 000000000000..fdb2307e60fa --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationArtifactType.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class ApplicationArtifactTypeExtensions + { + public static string ToSerialString(this ApplicationArtifactType value) => value switch + { + ApplicationArtifactType.Template => "Template", + ApplicationArtifactType.Custom => "Custom", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ApplicationArtifactType value.") + }; + + public static ApplicationArtifactType ToApplicationArtifactType(this string value) + { + if (string.Equals(value, "Template", StringComparison.InvariantCultureIgnoreCase)) return ApplicationArtifactType.Template; + if (string.Equals(value, "Custom", StringComparison.InvariantCultureIgnoreCase)) return ApplicationArtifactType.Custom; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ApplicationArtifactType value."); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationArtifactType.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationArtifactType.cs new file mode 100644 index 000000000000..d60a2455ce47 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationArtifactType.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The managed application artifact type. + public enum ApplicationArtifactType + { + /// Template. + Template, + /// Custom. + Custom + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationDefinition.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationDefinition.Serialization.cs new file mode 100644 index 000000000000..d6aea48c316d --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationDefinition.Serialization.cs @@ -0,0 +1,333 @@ +// 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.Management.Resources.Models +{ + public partial class ApplicationDefinition : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (ManagedBy != null) + { + writer.WritePropertyName("managedBy"); + writer.WriteStringValue(ManagedBy); + } + if (Sku != null) + { + writer.WritePropertyName("sku"); + writer.WriteObjectValue(Sku); + } + if (Identity != null) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + if (Location != null) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WritePropertyName("lockLevel"); + writer.WriteStringValue(LockLevel.ToSerialString()); + if (DisplayName != null) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (IsEnabled != null) + { + writer.WritePropertyName("isEnabled"); + writer.WriteStringValue(IsEnabled); + } + writer.WritePropertyName("authorizations"); + writer.WriteStartArray(); + foreach (var item in Authorizations) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + if (Artifacts != null) + { + writer.WritePropertyName("artifacts"); + writer.WriteStartArray(); + foreach (var item in Artifacts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Description != null) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(Description); + } + if (PackageFileUri != null) + { + writer.WritePropertyName("packageFileUri"); + writer.WriteStringValue(PackageFileUri); + } + if (MainTemplate != null) + { + writer.WritePropertyName("mainTemplate"); + writer.WriteObjectValue(MainTemplate); + } + if (CreateUiDefinition != null) + { + writer.WritePropertyName("createUiDefinition"); + writer.WriteObjectValue(CreateUiDefinition); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ApplicationDefinition DeserializeApplicationDefinition(JsonElement element) + { + string managedBy = default; + SkuAutoGenerated sku = default; + IdentityAutoGenerated2 identity = default; + string id = default; + string name = default; + string type = default; + string location = default; + IDictionary tags = default; + ApplicationLockLevel lockLevel = default; + string displayName = default; + string isEnabled = default; + IList authorizations = default; + IList artifacts = default; + string description = default; + string packageFileUri = default; + object mainTemplate = default; + object createUiDefinition = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("managedBy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("sku")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = SkuAutoGenerated.DeserializeSkuAutoGenerated(property.Value); + continue; + } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = IdentityAutoGenerated2.DeserializeIdentityAutoGenerated2(property.Value); + continue; + } + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("lockLevel")) + { + lockLevel = property0.Value.GetString().ToApplicationLockLevel(); + continue; + } + if (property0.NameEquals("displayName")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("isEnabled")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isEnabled = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("authorizations")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ApplicationProviderAuthorization.DeserializeApplicationProviderAuthorization(item)); + } + } + authorizations = array; + continue; + } + if (property0.NameEquals("artifacts")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ApplicationArtifact.DeserializeApplicationArtifact(item)); + } + } + artifacts = array; + continue; + } + if (property0.NameEquals("description")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("packageFileUri")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + packageFileUri = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("mainTemplate")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mainTemplate = property0.Value.GetObject(); + continue; + } + if (property0.NameEquals("createUiDefinition")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createUiDefinition = property0.Value.GetObject(); + continue; + } + } + continue; + } + } + return new ApplicationDefinition(id, name, type, location, tags, managedBy, sku, identity, lockLevel, displayName, isEnabled, authorizations, artifacts, description, packageFileUri, mainTemplate, createUiDefinition); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationDefinition.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationDefinition.cs new file mode 100644 index 000000000000..316267011cf9 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationDefinition.cs @@ -0,0 +1,81 @@ +// 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.Management.Resources.Models +{ + /// Information about managed application definition. + public partial class ApplicationDefinition : GenericResourceAutoGenerated + { + /// Initializes a new instance of ApplicationDefinition. + /// The managed application lock level. + /// The managed application provider authorizations. + public ApplicationDefinition(ApplicationLockLevel lockLevel, IEnumerable authorizations) + { + if (authorizations == null) + { + throw new ArgumentNullException(nameof(authorizations)); + } + + LockLevel = lockLevel; + Authorizations = authorizations.ToArray(); + } + + /// Initializes a new instance of ApplicationDefinition. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// ID of the resource that manages this resource. + /// The SKU of the resource. + /// The identity of the resource. + /// The managed application lock level. + /// The managed application definition display name. + /// A value indicating whether the package is enabled or not. + /// The managed application provider authorizations. + /// The collection of managed application artifacts. The portal will use the files specified as artifacts to construct the user experience of creating a managed application from a managed application definition. + /// The managed application definition description. + /// The managed application definition package file Uri. Use this element. + /// The inline main template json which has resources to be provisioned. It can be a JObject or well-formed JSON string. + /// The createUiDefinition json for the backing template with Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. + internal ApplicationDefinition(string id, string name, string type, string location, IDictionary tags, string managedBy, SkuAutoGenerated sku, IdentityAutoGenerated2 identity, ApplicationLockLevel lockLevel, string displayName, string isEnabled, IList authorizations, IList artifacts, string description, string packageFileUri, object mainTemplate, object createUiDefinition) : base(id, name, type, location, tags, managedBy, sku, identity) + { + LockLevel = lockLevel; + DisplayName = displayName; + IsEnabled = isEnabled; + Authorizations = authorizations; + Artifacts = artifacts; + Description = description; + PackageFileUri = packageFileUri; + MainTemplate = mainTemplate; + CreateUiDefinition = createUiDefinition; + } + + /// The managed application lock level. + public ApplicationLockLevel LockLevel { get; set; } + /// The managed application definition display name. + public string DisplayName { get; set; } + /// A value indicating whether the package is enabled or not. + public string IsEnabled { get; set; } + /// The managed application provider authorizations. + public IList Authorizations { get; set; } + /// The collection of managed application artifacts. The portal will use the files specified as artifacts to construct the user experience of creating a managed application from a managed application definition. + public IList Artifacts { get; set; } + /// The managed application definition description. + public string Description { get; set; } + /// The managed application definition package file Uri. Use this element. + public string PackageFileUri { get; set; } + /// The inline main template json which has resources to be provisioned. It can be a JObject or well-formed JSON string. + public object MainTemplate { get; set; } + /// The createUiDefinition json for the backing template with Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. + public object CreateUiDefinition { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationDefinitionListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationDefinitionListResult.Serialization.cs new file mode 100644 index 000000000000..97e46577c7c9 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationDefinitionListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class ApplicationDefinitionListResult + { + internal static ApplicationDefinitionListResult DeserializeApplicationDefinitionListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ApplicationDefinition.DeserializeApplicationDefinition(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new ApplicationDefinitionListResult(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationDefinitionListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationDefinitionListResult.cs new file mode 100644 index 000000000000..93475991e1b1 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationDefinitionListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// List of managed application definitions. + public partial class ApplicationDefinitionListResult + { + /// Initializes a new instance of ApplicationDefinitionListResult. + internal ApplicationDefinitionListResult() + { + } + + /// Initializes a new instance of ApplicationDefinitionListResult. + /// The array of managed application definitions. + /// The URL to use for getting the next set of results. + internal ApplicationDefinitionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The array of managed application definitions. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationListResult.Serialization.cs new file mode 100644 index 000000000000..3e0896aa392d --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class ApplicationListResult + { + internal static ApplicationListResult DeserializeApplicationListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(Application.DeserializeApplication(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new ApplicationListResult(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationListResult.cs new file mode 100644 index 000000000000..629119ebbaaf --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// List of managed applications. + public partial class ApplicationListResult + { + /// Initializes a new instance of ApplicationListResult. + internal ApplicationListResult() + { + } + + /// Initializes a new instance of ApplicationListResult. + /// The array of managed applications. + /// The URL to use for getting the next set of results. + internal ApplicationListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The array of managed applications. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationLockLevel.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationLockLevel.Serialization.cs new file mode 100644 index 000000000000..21766325f6fd --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationLockLevel.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class ApplicationLockLevelExtensions + { + public static string ToSerialString(this ApplicationLockLevel value) => value switch + { + ApplicationLockLevel.CanNotDelete => "CanNotDelete", + ApplicationLockLevel.ReadOnly => "ReadOnly", + ApplicationLockLevel.None => "None", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ApplicationLockLevel value.") + }; + + public static ApplicationLockLevel ToApplicationLockLevel(this string value) + { + if (string.Equals(value, "CanNotDelete", StringComparison.InvariantCultureIgnoreCase)) return ApplicationLockLevel.CanNotDelete; + if (string.Equals(value, "ReadOnly", StringComparison.InvariantCultureIgnoreCase)) return ApplicationLockLevel.ReadOnly; + if (string.Equals(value, "None", StringComparison.InvariantCultureIgnoreCase)) return ApplicationLockLevel.None; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ApplicationLockLevel value."); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationLockLevel.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationLockLevel.cs new file mode 100644 index 000000000000..579138a092b2 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationLockLevel.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The managed application lock level. + public enum ApplicationLockLevel + { + /// CanNotDelete. + CanNotDelete, + /// ReadOnly. + ReadOnly, + /// None. + None + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationPatchable.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationPatchable.Serialization.cs new file mode 100644 index 000000000000..d1f557a8b5ec --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationPatchable.Serialization.cs @@ -0,0 +1,283 @@ +// 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.Management.Resources.Models +{ + public partial class ApplicationPatchable : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Plan != null) + { + writer.WritePropertyName("plan"); + writer.WriteObjectValue(Plan); + } + if (Kind != null) + { + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind); + } + if (ManagedBy != null) + { + writer.WritePropertyName("managedBy"); + writer.WriteStringValue(ManagedBy); + } + if (Sku != null) + { + writer.WritePropertyName("sku"); + writer.WriteObjectValue(Sku); + } + if (Identity != null) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + if (Location != null) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (ManagedResourceGroupId != null) + { + writer.WritePropertyName("managedResourceGroupId"); + writer.WriteStringValue(ManagedResourceGroupId); + } + if (ApplicationDefinitionId != null) + { + writer.WritePropertyName("applicationDefinitionId"); + writer.WriteStringValue(ApplicationDefinitionId); + } + if (Parameters != null) + { + writer.WritePropertyName("parameters"); + writer.WriteObjectValue(Parameters); + } + if (Outputs != null) + { + writer.WritePropertyName("outputs"); + writer.WriteObjectValue(Outputs); + } + if (ProvisioningState != null) + { + writer.WritePropertyName("provisioningState"); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ApplicationPatchable DeserializeApplicationPatchable(JsonElement element) + { + PlanPatchable plan = default; + string kind = default; + string managedBy = default; + SkuAutoGenerated sku = default; + IdentityAutoGenerated2 identity = default; + string id = default; + string name = default; + string type = default; + string location = default; + IDictionary tags = default; + string managedResourceGroupId = default; + string applicationDefinitionId = default; + object parameters = default; + object outputs = default; + ProvisioningState? provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("plan")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + plan = PlanPatchable.DeserializePlanPatchable(property.Value); + continue; + } + if (property.NameEquals("kind")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("managedBy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("sku")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = SkuAutoGenerated.DeserializeSkuAutoGenerated(property.Value); + continue; + } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = IdentityAutoGenerated2.DeserializeIdentityAutoGenerated2(property.Value); + continue; + } + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("managedResourceGroupId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedResourceGroupId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("applicationDefinitionId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationDefinitionId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("parameters")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = property0.Value.GetObject(); + continue; + } + if (property0.NameEquals("outputs")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + outputs = property0.Value.GetObject(); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new ApplicationPatchable(id, name, type, location, tags, managedBy, sku, identity, plan, kind, managedResourceGroupId, applicationDefinitionId, parameters, outputs, provisioningState); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationPatchable.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationPatchable.cs new file mode 100644 index 000000000000..ca0a0ff7774a --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationPatchable.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Information about managed application. + public partial class ApplicationPatchable : GenericResourceAutoGenerated + { + /// Initializes a new instance of ApplicationPatchable. + public ApplicationPatchable() + { + } + + /// Initializes a new instance of ApplicationPatchable. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// ID of the resource that manages this resource. + /// The SKU of the resource. + /// The identity of the resource. + /// The plan information. + /// The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + /// The managed resource group Id. + /// The fully qualified path of managed application definition Id. + /// Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string. + /// Name and value pairs that define the managed application outputs. + /// The managed application provisioning state. + internal ApplicationPatchable(string id, string name, string type, string location, IDictionary tags, string managedBy, SkuAutoGenerated sku, IdentityAutoGenerated2 identity, PlanPatchable plan, string kind, string managedResourceGroupId, string applicationDefinitionId, object parameters, object outputs, ProvisioningState? provisioningState) : base(id, name, type, location, tags, managedBy, sku, identity) + { + Plan = plan; + Kind = kind; + ManagedResourceGroupId = managedResourceGroupId; + ApplicationDefinitionId = applicationDefinitionId; + Parameters = parameters; + Outputs = outputs; + ProvisioningState = provisioningState; + } + + /// The plan information. + public PlanPatchable Plan { get; set; } + /// The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + public string Kind { get; set; } + /// The managed resource group Id. + public string ManagedResourceGroupId { get; set; } + /// The fully qualified path of managed application definition Id. + public string ApplicationDefinitionId { get; set; } + /// Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string. + public object Parameters { get; set; } + /// Name and value pairs that define the managed application outputs. + public object Outputs { get; } + /// The managed application provisioning state. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationProviderAuthorization.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationProviderAuthorization.Serialization.cs new file mode 100644 index 000000000000..efdc16f6608c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationProviderAuthorization.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.Management.Resources.Models +{ + public partial class ApplicationProviderAuthorization : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("principalId"); + writer.WriteStringValue(PrincipalId); + writer.WritePropertyName("roleDefinitionId"); + writer.WriteStringValue(RoleDefinitionId); + writer.WriteEndObject(); + } + + internal static ApplicationProviderAuthorization DeserializeApplicationProviderAuthorization(JsonElement element) + { + string principalId = default; + string roleDefinitionId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + principalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("roleDefinitionId")) + { + roleDefinitionId = property.Value.GetString(); + continue; + } + } + return new ApplicationProviderAuthorization(principalId, roleDefinitionId); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationProviderAuthorization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationProviderAuthorization.cs new file mode 100644 index 000000000000..660c046122af --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ApplicationProviderAuthorization.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// The managed application provider authorization. + public partial class ApplicationProviderAuthorization + { + /// Initializes a new instance of ApplicationProviderAuthorization. + /// The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the managed application resources. + /// The provider's role definition identifier. This role will define all the permissions that the provider must have on the managed application's container resource group. This role definition cannot have permission to delete the resource group. + public ApplicationProviderAuthorization(string principalId, string roleDefinitionId) + { + if (principalId == null) + { + throw new ArgumentNullException(nameof(principalId)); + } + if (roleDefinitionId == null) + { + throw new ArgumentNullException(nameof(roleDefinitionId)); + } + + PrincipalId = principalId; + RoleDefinitionId = roleDefinitionId; + } + + /// The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the managed application resources. + public string PrincipalId { get; set; } + /// The provider's role definition identifier. This role will define all the permissions that the provider must have on the managed application's container resource group. This role definition cannot have permission to delete the resource group. + public string RoleDefinitionId { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureCliScript.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureCliScript.Serialization.cs new file mode 100644 index 000000000000..6fb4b18b49b5 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureCliScript.Serialization.cs @@ -0,0 +1,421 @@ +// 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; + +namespace Azure.Management.Resources.Models +{ + public partial class AzureCliScript : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind.ToString()); + if (SystemData != null) + { + writer.WritePropertyName("systemData"); + writer.WriteObjectValue(SystemData); + } + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (ContainerSettings != null) + { + writer.WritePropertyName("containerSettings"); + writer.WriteObjectValue(ContainerSettings); + } + if (StorageAccountSettings != null) + { + writer.WritePropertyName("storageAccountSettings"); + writer.WriteObjectValue(StorageAccountSettings); + } + if (CleanupPreference != null) + { + writer.WritePropertyName("cleanupPreference"); + writer.WriteStringValue(CleanupPreference.Value.ToString()); + } + if (ProvisioningState != null) + { + writer.WritePropertyName("provisioningState"); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Status != null) + { + writer.WritePropertyName("status"); + writer.WriteObjectValue(Status); + } + if (Outputs != null) + { + writer.WritePropertyName("outputs"); + writer.WriteStartObject(); + foreach (var item in Outputs) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (PrimaryScriptUri != null) + { + writer.WritePropertyName("primaryScriptUri"); + writer.WriteStringValue(PrimaryScriptUri); + } + if (SupportingScriptUris != null) + { + writer.WritePropertyName("supportingScriptUris"); + writer.WriteStartArray(); + foreach (var item in SupportingScriptUris) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (ScriptContent != null) + { + writer.WritePropertyName("scriptContent"); + writer.WriteStringValue(ScriptContent); + } + if (Arguments != null) + { + writer.WritePropertyName("arguments"); + writer.WriteStringValue(Arguments); + } + if (EnvironmentVariables != null) + { + writer.WritePropertyName("environmentVariables"); + writer.WriteStartArray(); + foreach (var item in EnvironmentVariables) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (ForceUpdateTag != null) + { + writer.WritePropertyName("forceUpdateTag"); + writer.WriteStringValue(ForceUpdateTag); + } + writer.WritePropertyName("retentionInterval"); + writer.WriteStringValue(RetentionInterval, "P"); + if (Timeout != null) + { + writer.WritePropertyName("timeout"); + writer.WriteStringValue(Timeout.Value, "P"); + } + writer.WritePropertyName("azCliVersion"); + writer.WriteStringValue(AzCliVersion); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static AzureCliScript DeserializeAzureCliScript(JsonElement element) + { + ManagedServiceIdentity identity = default; + string location = default; + IDictionary tags = default; + ScriptType kind = default; + SystemData systemData = default; + string id = default; + string name = default; + string type = default; + ContainerConfiguration containerSettings = default; + StorageAccountConfiguration storageAccountSettings = default; + CleanupOptions? cleanupPreference = default; + ScriptProvisioningState? provisioningState = default; + ScriptStatus status = default; + IDictionary outputs = default; + string primaryScriptUri = default; + IList supportingScriptUris = default; + string scriptContent = default; + string arguments = default; + IList environmentVariables = default; + string forceUpdateTag = default; + TimeSpan retentionInterval = default; + TimeSpan? timeout = default; + string azCliVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity")) + { + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (property.NameEquals("kind")) + { + kind = new ScriptType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = SystemData.DeserializeSystemData(property.Value); + continue; + } + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("containerSettings")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerSettings = ContainerConfiguration.DeserializeContainerConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("storageAccountSettings")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageAccountSettings = StorageAccountConfiguration.DeserializeStorageAccountConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("cleanupPreference")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cleanupPreference = new CleanupOptions(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ScriptProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("status")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = ScriptStatus.DeserializeScriptStatus(property0.Value); + continue; + } + if (property0.NameEquals("outputs")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + if (property1.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property1.Name, null); + } + else + { + dictionary.Add(property1.Name, property1.Value.GetObject()); + } + } + outputs = dictionary; + continue; + } + if (property0.NameEquals("primaryScriptUri")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + primaryScriptUri = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("supportingScriptUris")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + supportingScriptUris = array; + continue; + } + if (property0.NameEquals("scriptContent")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scriptContent = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("arguments")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + arguments = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("environmentVariables")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(EnvironmentVariable.DeserializeEnvironmentVariable(item)); + } + } + environmentVariables = array; + continue; + } + if (property0.NameEquals("forceUpdateTag")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + forceUpdateTag = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("retentionInterval")) + { + retentionInterval = property0.Value.GetTimeSpan("P"); + continue; + } + if (property0.NameEquals("timeout")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeout = property0.Value.GetTimeSpan("P"); + continue; + } + if (property0.NameEquals("azCliVersion")) + { + azCliVersion = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new AzureCliScript(id, name, type, identity, location, tags, kind, systemData, containerSettings, storageAccountSettings, cleanupPreference, provisioningState, status, outputs, primaryScriptUri, supportingScriptUris, scriptContent, arguments, environmentVariables, forceUpdateTag, retentionInterval, timeout, azCliVersion); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureCliScript.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureCliScript.cs new file mode 100644 index 000000000000..90b19d056f6e --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureCliScript.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Object model for the Azure CLI script. + public partial class AzureCliScript : DeploymentScript + { + /// Initializes a new instance of AzureCliScript. + /// Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported. + /// The location of the ACI and the storage account for the deployment script. + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + /// Azure CLI module version to be used. + public AzureCliScript(ManagedServiceIdentity identity, string location, TimeSpan retentionInterval, string azCliVersion) : base(identity, location) + { + if (identity == null) + { + throw new ArgumentNullException(nameof(identity)); + } + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (azCliVersion == null) + { + throw new ArgumentNullException(nameof(azCliVersion)); + } + + RetentionInterval = retentionInterval; + AzCliVersion = azCliVersion; + Kind = "AzureCLI"; + } + + /// Initializes a new instance of AzureCliScript. + /// String Id used to locate any resource on Azure. + /// Name of this resource. + /// Type of this resource. + /// Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported. + /// The location of the ACI and the storage account for the deployment script. + /// Resource tags. + /// Type of the script. + /// The system metadata related to this resource. + /// Container settings. + /// Storage Account settings. + /// The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. + /// State of the script execution. This only appears in the response. + /// Contains the results of script execution. + /// List of script outputs. + /// Uri for the script. This is the entry point for the external script. + /// Supporting files for the external script. + /// Script body. + /// Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'. + /// The environment variables to pass over to the script. + /// Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be current time stamp or a GUID. + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + /// Maximum allowed script execution time specified in ISO 8601 format. Default value is PT1H. + /// Azure CLI module version to be used. + internal AzureCliScript(string id, string name, string type, ManagedServiceIdentity identity, string location, IDictionary tags, ScriptType kind, SystemData systemData, ContainerConfiguration containerSettings, StorageAccountConfiguration storageAccountSettings, CleanupOptions? cleanupPreference, ScriptProvisioningState? provisioningState, ScriptStatus status, IDictionary outputs, string primaryScriptUri, IList supportingScriptUris, string scriptContent, string arguments, IList environmentVariables, string forceUpdateTag, TimeSpan retentionInterval, TimeSpan? timeout, string azCliVersion) : base(id, name, type, identity, location, tags, kind, systemData) + { + ContainerSettings = containerSettings; + StorageAccountSettings = storageAccountSettings; + CleanupPreference = cleanupPreference; + ProvisioningState = provisioningState; + Status = status; + Outputs = outputs; + PrimaryScriptUri = primaryScriptUri; + SupportingScriptUris = supportingScriptUris; + ScriptContent = scriptContent; + Arguments = arguments; + EnvironmentVariables = environmentVariables; + ForceUpdateTag = forceUpdateTag; + RetentionInterval = retentionInterval; + Timeout = timeout; + AzCliVersion = azCliVersion; + Kind = kind; + } + + /// Container settings. + public ContainerConfiguration ContainerSettings { get; set; } + /// Storage Account settings. + public StorageAccountConfiguration StorageAccountSettings { get; set; } + /// The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. + public CleanupOptions? CleanupPreference { get; set; } + /// State of the script execution. This only appears in the response. + public ScriptProvisioningState? ProvisioningState { get; } + /// Contains the results of script execution. + public ScriptStatus Status { get; } + /// List of script outputs. + public IDictionary Outputs { get; } + /// Uri for the script. This is the entry point for the external script. + public string PrimaryScriptUri { get; set; } + /// Supporting files for the external script. + public IList SupportingScriptUris { get; set; } + /// Script body. + public string ScriptContent { get; set; } + /// Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'. + public string Arguments { get; set; } + /// The environment variables to pass over to the script. + public IList EnvironmentVariables { get; set; } + /// Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be current time stamp or a GUID. + public string ForceUpdateTag { get; set; } + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + public TimeSpan RetentionInterval { get; set; } + /// Maximum allowed script execution time specified in ISO 8601 format. Default value is PT1H. + public TimeSpan? Timeout { get; set; } + /// Azure CLI module version to be used. + public string AzCliVersion { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureCliScriptProperties.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureCliScriptProperties.Serialization.cs new file mode 100644 index 000000000000..22b6e30c730f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureCliScriptProperties.Serialization.cs @@ -0,0 +1,294 @@ +// 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; + +namespace Azure.Management.Resources.Models +{ + public partial class AzureCliScriptProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("azCliVersion"); + writer.WriteStringValue(AzCliVersion); + if (PrimaryScriptUri != null) + { + writer.WritePropertyName("primaryScriptUri"); + writer.WriteStringValue(PrimaryScriptUri); + } + if (SupportingScriptUris != null) + { + writer.WritePropertyName("supportingScriptUris"); + writer.WriteStartArray(); + foreach (var item in SupportingScriptUris) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (ScriptContent != null) + { + writer.WritePropertyName("scriptContent"); + writer.WriteStringValue(ScriptContent); + } + if (Arguments != null) + { + writer.WritePropertyName("arguments"); + writer.WriteStringValue(Arguments); + } + if (EnvironmentVariables != null) + { + writer.WritePropertyName("environmentVariables"); + writer.WriteStartArray(); + foreach (var item in EnvironmentVariables) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (ForceUpdateTag != null) + { + writer.WritePropertyName("forceUpdateTag"); + writer.WriteStringValue(ForceUpdateTag); + } + writer.WritePropertyName("retentionInterval"); + writer.WriteStringValue(RetentionInterval, "P"); + if (Timeout != null) + { + writer.WritePropertyName("timeout"); + writer.WriteStringValue(Timeout.Value, "P"); + } + if (ContainerSettings != null) + { + writer.WritePropertyName("containerSettings"); + writer.WriteObjectValue(ContainerSettings); + } + if (StorageAccountSettings != null) + { + writer.WritePropertyName("storageAccountSettings"); + writer.WriteObjectValue(StorageAccountSettings); + } + if (CleanupPreference != null) + { + writer.WritePropertyName("cleanupPreference"); + writer.WriteStringValue(CleanupPreference.Value.ToString()); + } + if (ProvisioningState != null) + { + writer.WritePropertyName("provisioningState"); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Status != null) + { + writer.WritePropertyName("status"); + writer.WriteObjectValue(Status); + } + if (Outputs != null) + { + writer.WritePropertyName("outputs"); + writer.WriteStartObject(); + foreach (var item in Outputs) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static AzureCliScriptProperties DeserializeAzureCliScriptProperties(JsonElement element) + { + string azCliVersion = default; + string primaryScriptUri = default; + IList supportingScriptUris = default; + string scriptContent = default; + string arguments = default; + IList environmentVariables = default; + string forceUpdateTag = default; + TimeSpan retentionInterval = default; + TimeSpan? timeout = default; + ContainerConfiguration containerSettings = default; + StorageAccountConfiguration storageAccountSettings = default; + CleanupOptions? cleanupPreference = default; + ScriptProvisioningState? provisioningState = default; + ScriptStatus status = default; + IDictionary outputs = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azCliVersion")) + { + azCliVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("primaryScriptUri")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + primaryScriptUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("supportingScriptUris")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + supportingScriptUris = array; + continue; + } + if (property.NameEquals("scriptContent")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scriptContent = property.Value.GetString(); + continue; + } + if (property.NameEquals("arguments")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + arguments = property.Value.GetString(); + continue; + } + if (property.NameEquals("environmentVariables")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(EnvironmentVariable.DeserializeEnvironmentVariable(item)); + } + } + environmentVariables = array; + continue; + } + if (property.NameEquals("forceUpdateTag")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + forceUpdateTag = property.Value.GetString(); + continue; + } + if (property.NameEquals("retentionInterval")) + { + retentionInterval = property.Value.GetTimeSpan("P"); + continue; + } + if (property.NameEquals("timeout")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeout = property.Value.GetTimeSpan("P"); + continue; + } + if (property.NameEquals("containerSettings")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerSettings = ContainerConfiguration.DeserializeContainerConfiguration(property.Value); + continue; + } + if (property.NameEquals("storageAccountSettings")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageAccountSettings = StorageAccountConfiguration.DeserializeStorageAccountConfiguration(property.Value); + continue; + } + if (property.NameEquals("cleanupPreference")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cleanupPreference = new CleanupOptions(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ScriptProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = ScriptStatus.DeserializeScriptStatus(property.Value); + continue; + } + if (property.NameEquals("outputs")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetObject()); + } + } + outputs = dictionary; + continue; + } + } + return new AzureCliScriptProperties(containerSettings, storageAccountSettings, cleanupPreference, provisioningState, status, outputs, azCliVersion, primaryScriptUri, supportingScriptUris, scriptContent, arguments, environmentVariables, forceUpdateTag, retentionInterval, timeout); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureCliScriptProperties.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureCliScriptProperties.cs new file mode 100644 index 000000000000..8c145b378223 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureCliScriptProperties.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Properties of the Azure CLI script object. + public partial class AzureCliScriptProperties : DeploymentScriptPropertiesBase + { + /// Initializes a new instance of AzureCliScriptProperties. + /// Azure CLI module version to be used. + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + public AzureCliScriptProperties(string azCliVersion, TimeSpan retentionInterval) + { + if (azCliVersion == null) + { + throw new ArgumentNullException(nameof(azCliVersion)); + } + + AzCliVersion = azCliVersion; + RetentionInterval = retentionInterval; + } + + /// Initializes a new instance of AzureCliScriptProperties. + /// Container settings. + /// Storage Account settings. + /// The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. + /// State of the script execution. This only appears in the response. + /// Contains the results of script execution. + /// List of script outputs. + /// Azure CLI module version to be used. + /// Uri for the script. This is the entry point for the external script. + /// Supporting files for the external script. + /// Script body. + /// Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'. + /// The environment variables to pass over to the script. + /// Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be current time stamp or a GUID. + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + /// Maximum allowed script execution time specified in ISO 8601 format. Default value is PT1H. + internal AzureCliScriptProperties(ContainerConfiguration containerSettings, StorageAccountConfiguration storageAccountSettings, CleanupOptions? cleanupPreference, ScriptProvisioningState? provisioningState, ScriptStatus status, IDictionary outputs, string azCliVersion, string primaryScriptUri, IList supportingScriptUris, string scriptContent, string arguments, IList environmentVariables, string forceUpdateTag, TimeSpan retentionInterval, TimeSpan? timeout) : base(containerSettings, storageAccountSettings, cleanupPreference, provisioningState, status, outputs) + { + AzCliVersion = azCliVersion; + PrimaryScriptUri = primaryScriptUri; + SupportingScriptUris = supportingScriptUris; + ScriptContent = scriptContent; + Arguments = arguments; + EnvironmentVariables = environmentVariables; + ForceUpdateTag = forceUpdateTag; + RetentionInterval = retentionInterval; + Timeout = timeout; + } + + /// Azure CLI module version to be used. + public string AzCliVersion { get; set; } + /// Uri for the script. This is the entry point for the external script. + public string PrimaryScriptUri { get; set; } + /// Supporting files for the external script. + public IList SupportingScriptUris { get; set; } + /// Script body. + public string ScriptContent { get; set; } + /// Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'. + public string Arguments { get; set; } + /// The environment variables to pass over to the script. + public IList EnvironmentVariables { get; set; } + /// Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be current time stamp or a GUID. + public string ForceUpdateTag { get; set; } + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + public TimeSpan RetentionInterval { get; set; } + /// Maximum allowed script execution time specified in ISO 8601 format. Default value is PT1H. + public TimeSpan? Timeout { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzurePowerShellScript.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzurePowerShellScript.Serialization.cs new file mode 100644 index 000000000000..c3f2410d3b13 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzurePowerShellScript.Serialization.cs @@ -0,0 +1,421 @@ +// 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; + +namespace Azure.Management.Resources.Models +{ + public partial class AzurePowerShellScript : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind.ToString()); + if (SystemData != null) + { + writer.WritePropertyName("systemData"); + writer.WriteObjectValue(SystemData); + } + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (ContainerSettings != null) + { + writer.WritePropertyName("containerSettings"); + writer.WriteObjectValue(ContainerSettings); + } + if (StorageAccountSettings != null) + { + writer.WritePropertyName("storageAccountSettings"); + writer.WriteObjectValue(StorageAccountSettings); + } + if (CleanupPreference != null) + { + writer.WritePropertyName("cleanupPreference"); + writer.WriteStringValue(CleanupPreference.Value.ToString()); + } + if (ProvisioningState != null) + { + writer.WritePropertyName("provisioningState"); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Status != null) + { + writer.WritePropertyName("status"); + writer.WriteObjectValue(Status); + } + if (Outputs != null) + { + writer.WritePropertyName("outputs"); + writer.WriteStartObject(); + foreach (var item in Outputs) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (PrimaryScriptUri != null) + { + writer.WritePropertyName("primaryScriptUri"); + writer.WriteStringValue(PrimaryScriptUri); + } + if (SupportingScriptUris != null) + { + writer.WritePropertyName("supportingScriptUris"); + writer.WriteStartArray(); + foreach (var item in SupportingScriptUris) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (ScriptContent != null) + { + writer.WritePropertyName("scriptContent"); + writer.WriteStringValue(ScriptContent); + } + if (Arguments != null) + { + writer.WritePropertyName("arguments"); + writer.WriteStringValue(Arguments); + } + if (EnvironmentVariables != null) + { + writer.WritePropertyName("environmentVariables"); + writer.WriteStartArray(); + foreach (var item in EnvironmentVariables) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (ForceUpdateTag != null) + { + writer.WritePropertyName("forceUpdateTag"); + writer.WriteStringValue(ForceUpdateTag); + } + writer.WritePropertyName("retentionInterval"); + writer.WriteStringValue(RetentionInterval, "P"); + if (Timeout != null) + { + writer.WritePropertyName("timeout"); + writer.WriteStringValue(Timeout.Value, "P"); + } + writer.WritePropertyName("azPowerShellVersion"); + writer.WriteStringValue(AzPowerShellVersion); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static AzurePowerShellScript DeserializeAzurePowerShellScript(JsonElement element) + { + ManagedServiceIdentity identity = default; + string location = default; + IDictionary tags = default; + ScriptType kind = default; + SystemData systemData = default; + string id = default; + string name = default; + string type = default; + ContainerConfiguration containerSettings = default; + StorageAccountConfiguration storageAccountSettings = default; + CleanupOptions? cleanupPreference = default; + ScriptProvisioningState? provisioningState = default; + ScriptStatus status = default; + IDictionary outputs = default; + string primaryScriptUri = default; + IList supportingScriptUris = default; + string scriptContent = default; + string arguments = default; + IList environmentVariables = default; + string forceUpdateTag = default; + TimeSpan retentionInterval = default; + TimeSpan? timeout = default; + string azPowerShellVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity")) + { + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (property.NameEquals("kind")) + { + kind = new ScriptType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = SystemData.DeserializeSystemData(property.Value); + continue; + } + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("containerSettings")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerSettings = ContainerConfiguration.DeserializeContainerConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("storageAccountSettings")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageAccountSettings = StorageAccountConfiguration.DeserializeStorageAccountConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("cleanupPreference")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cleanupPreference = new CleanupOptions(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ScriptProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("status")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = ScriptStatus.DeserializeScriptStatus(property0.Value); + continue; + } + if (property0.NameEquals("outputs")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + if (property1.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property1.Name, null); + } + else + { + dictionary.Add(property1.Name, property1.Value.GetObject()); + } + } + outputs = dictionary; + continue; + } + if (property0.NameEquals("primaryScriptUri")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + primaryScriptUri = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("supportingScriptUris")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + supportingScriptUris = array; + continue; + } + if (property0.NameEquals("scriptContent")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scriptContent = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("arguments")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + arguments = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("environmentVariables")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(EnvironmentVariable.DeserializeEnvironmentVariable(item)); + } + } + environmentVariables = array; + continue; + } + if (property0.NameEquals("forceUpdateTag")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + forceUpdateTag = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("retentionInterval")) + { + retentionInterval = property0.Value.GetTimeSpan("P"); + continue; + } + if (property0.NameEquals("timeout")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeout = property0.Value.GetTimeSpan("P"); + continue; + } + if (property0.NameEquals("azPowerShellVersion")) + { + azPowerShellVersion = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new AzurePowerShellScript(id, name, type, identity, location, tags, kind, systemData, containerSettings, storageAccountSettings, cleanupPreference, provisioningState, status, outputs, primaryScriptUri, supportingScriptUris, scriptContent, arguments, environmentVariables, forceUpdateTag, retentionInterval, timeout, azPowerShellVersion); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzurePowerShellScript.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzurePowerShellScript.cs new file mode 100644 index 000000000000..64a135587887 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzurePowerShellScript.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Object model for the Azure PowerShell script. + public partial class AzurePowerShellScript : DeploymentScript + { + /// Initializes a new instance of AzurePowerShellScript. + /// Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported. + /// The location of the ACI and the storage account for the deployment script. + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + /// Azure PowerShell module version to be used. + public AzurePowerShellScript(ManagedServiceIdentity identity, string location, TimeSpan retentionInterval, string azPowerShellVersion) : base(identity, location) + { + if (identity == null) + { + throw new ArgumentNullException(nameof(identity)); + } + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (azPowerShellVersion == null) + { + throw new ArgumentNullException(nameof(azPowerShellVersion)); + } + + RetentionInterval = retentionInterval; + AzPowerShellVersion = azPowerShellVersion; + Kind = "AzurePowerShell"; + } + + /// Initializes a new instance of AzurePowerShellScript. + /// String Id used to locate any resource on Azure. + /// Name of this resource. + /// Type of this resource. + /// Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported. + /// The location of the ACI and the storage account for the deployment script. + /// Resource tags. + /// Type of the script. + /// The system metadata related to this resource. + /// Container settings. + /// Storage Account settings. + /// The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. + /// State of the script execution. This only appears in the response. + /// Contains the results of script execution. + /// List of script outputs. + /// Uri for the script. This is the entry point for the external script. + /// Supporting files for the external script. + /// Script body. + /// Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'. + /// The environment variables to pass over to the script. + /// Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be current time stamp or a GUID. + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + /// Maximum allowed script execution time specified in ISO 8601 format. Default value is PT1H. + /// Azure PowerShell module version to be used. + internal AzurePowerShellScript(string id, string name, string type, ManagedServiceIdentity identity, string location, IDictionary tags, ScriptType kind, SystemData systemData, ContainerConfiguration containerSettings, StorageAccountConfiguration storageAccountSettings, CleanupOptions? cleanupPreference, ScriptProvisioningState? provisioningState, ScriptStatus status, IDictionary outputs, string primaryScriptUri, IList supportingScriptUris, string scriptContent, string arguments, IList environmentVariables, string forceUpdateTag, TimeSpan retentionInterval, TimeSpan? timeout, string azPowerShellVersion) : base(id, name, type, identity, location, tags, kind, systemData) + { + ContainerSettings = containerSettings; + StorageAccountSettings = storageAccountSettings; + CleanupPreference = cleanupPreference; + ProvisioningState = provisioningState; + Status = status; + Outputs = outputs; + PrimaryScriptUri = primaryScriptUri; + SupportingScriptUris = supportingScriptUris; + ScriptContent = scriptContent; + Arguments = arguments; + EnvironmentVariables = environmentVariables; + ForceUpdateTag = forceUpdateTag; + RetentionInterval = retentionInterval; + Timeout = timeout; + AzPowerShellVersion = azPowerShellVersion; + Kind = kind; + } + + /// Container settings. + public ContainerConfiguration ContainerSettings { get; set; } + /// Storage Account settings. + public StorageAccountConfiguration StorageAccountSettings { get; set; } + /// The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. + public CleanupOptions? CleanupPreference { get; set; } + /// State of the script execution. This only appears in the response. + public ScriptProvisioningState? ProvisioningState { get; } + /// Contains the results of script execution. + public ScriptStatus Status { get; } + /// List of script outputs. + public IDictionary Outputs { get; } + /// Uri for the script. This is the entry point for the external script. + public string PrimaryScriptUri { get; set; } + /// Supporting files for the external script. + public IList SupportingScriptUris { get; set; } + /// Script body. + public string ScriptContent { get; set; } + /// Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'. + public string Arguments { get; set; } + /// The environment variables to pass over to the script. + public IList EnvironmentVariables { get; set; } + /// Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be current time stamp or a GUID. + public string ForceUpdateTag { get; set; } + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + public TimeSpan RetentionInterval { get; set; } + /// Maximum allowed script execution time specified in ISO 8601 format. Default value is PT1H. + public TimeSpan? Timeout { get; set; } + /// Azure PowerShell module version to be used. + public string AzPowerShellVersion { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzurePowerShellScriptProperties.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzurePowerShellScriptProperties.Serialization.cs new file mode 100644 index 000000000000..1c9c42adc650 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzurePowerShellScriptProperties.Serialization.cs @@ -0,0 +1,294 @@ +// 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; + +namespace Azure.Management.Resources.Models +{ + public partial class AzurePowerShellScriptProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("azPowerShellVersion"); + writer.WriteStringValue(AzPowerShellVersion); + if (PrimaryScriptUri != null) + { + writer.WritePropertyName("primaryScriptUri"); + writer.WriteStringValue(PrimaryScriptUri); + } + if (SupportingScriptUris != null) + { + writer.WritePropertyName("supportingScriptUris"); + writer.WriteStartArray(); + foreach (var item in SupportingScriptUris) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (ScriptContent != null) + { + writer.WritePropertyName("scriptContent"); + writer.WriteStringValue(ScriptContent); + } + if (Arguments != null) + { + writer.WritePropertyName("arguments"); + writer.WriteStringValue(Arguments); + } + if (EnvironmentVariables != null) + { + writer.WritePropertyName("environmentVariables"); + writer.WriteStartArray(); + foreach (var item in EnvironmentVariables) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (ForceUpdateTag != null) + { + writer.WritePropertyName("forceUpdateTag"); + writer.WriteStringValue(ForceUpdateTag); + } + writer.WritePropertyName("retentionInterval"); + writer.WriteStringValue(RetentionInterval, "P"); + if (Timeout != null) + { + writer.WritePropertyName("timeout"); + writer.WriteStringValue(Timeout.Value, "P"); + } + if (ContainerSettings != null) + { + writer.WritePropertyName("containerSettings"); + writer.WriteObjectValue(ContainerSettings); + } + if (StorageAccountSettings != null) + { + writer.WritePropertyName("storageAccountSettings"); + writer.WriteObjectValue(StorageAccountSettings); + } + if (CleanupPreference != null) + { + writer.WritePropertyName("cleanupPreference"); + writer.WriteStringValue(CleanupPreference.Value.ToString()); + } + if (ProvisioningState != null) + { + writer.WritePropertyName("provisioningState"); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Status != null) + { + writer.WritePropertyName("status"); + writer.WriteObjectValue(Status); + } + if (Outputs != null) + { + writer.WritePropertyName("outputs"); + writer.WriteStartObject(); + foreach (var item in Outputs) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static AzurePowerShellScriptProperties DeserializeAzurePowerShellScriptProperties(JsonElement element) + { + string azPowerShellVersion = default; + string primaryScriptUri = default; + IList supportingScriptUris = default; + string scriptContent = default; + string arguments = default; + IList environmentVariables = default; + string forceUpdateTag = default; + TimeSpan retentionInterval = default; + TimeSpan? timeout = default; + ContainerConfiguration containerSettings = default; + StorageAccountConfiguration storageAccountSettings = default; + CleanupOptions? cleanupPreference = default; + ScriptProvisioningState? provisioningState = default; + ScriptStatus status = default; + IDictionary outputs = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azPowerShellVersion")) + { + azPowerShellVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("primaryScriptUri")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + primaryScriptUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("supportingScriptUris")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + supportingScriptUris = array; + continue; + } + if (property.NameEquals("scriptContent")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scriptContent = property.Value.GetString(); + continue; + } + if (property.NameEquals("arguments")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + arguments = property.Value.GetString(); + continue; + } + if (property.NameEquals("environmentVariables")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(EnvironmentVariable.DeserializeEnvironmentVariable(item)); + } + } + environmentVariables = array; + continue; + } + if (property.NameEquals("forceUpdateTag")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + forceUpdateTag = property.Value.GetString(); + continue; + } + if (property.NameEquals("retentionInterval")) + { + retentionInterval = property.Value.GetTimeSpan("P"); + continue; + } + if (property.NameEquals("timeout")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeout = property.Value.GetTimeSpan("P"); + continue; + } + if (property.NameEquals("containerSettings")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerSettings = ContainerConfiguration.DeserializeContainerConfiguration(property.Value); + continue; + } + if (property.NameEquals("storageAccountSettings")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageAccountSettings = StorageAccountConfiguration.DeserializeStorageAccountConfiguration(property.Value); + continue; + } + if (property.NameEquals("cleanupPreference")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cleanupPreference = new CleanupOptions(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ScriptProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = ScriptStatus.DeserializeScriptStatus(property.Value); + continue; + } + if (property.NameEquals("outputs")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetObject()); + } + } + outputs = dictionary; + continue; + } + } + return new AzurePowerShellScriptProperties(containerSettings, storageAccountSettings, cleanupPreference, provisioningState, status, outputs, azPowerShellVersion, primaryScriptUri, supportingScriptUris, scriptContent, arguments, environmentVariables, forceUpdateTag, retentionInterval, timeout); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzurePowerShellScriptProperties.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzurePowerShellScriptProperties.cs new file mode 100644 index 000000000000..ae60189f6717 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzurePowerShellScriptProperties.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Properties of the Azure PowerShell script object. + public partial class AzurePowerShellScriptProperties : DeploymentScriptPropertiesBase + { + /// Initializes a new instance of AzurePowerShellScriptProperties. + /// Azure PowerShell module version to be used. + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + public AzurePowerShellScriptProperties(string azPowerShellVersion, TimeSpan retentionInterval) + { + if (azPowerShellVersion == null) + { + throw new ArgumentNullException(nameof(azPowerShellVersion)); + } + + AzPowerShellVersion = azPowerShellVersion; + RetentionInterval = retentionInterval; + } + + /// Initializes a new instance of AzurePowerShellScriptProperties. + /// Container settings. + /// Storage Account settings. + /// The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. + /// State of the script execution. This only appears in the response. + /// Contains the results of script execution. + /// List of script outputs. + /// Azure PowerShell module version to be used. + /// Uri for the script. This is the entry point for the external script. + /// Supporting files for the external script. + /// Script body. + /// Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'. + /// The environment variables to pass over to the script. + /// Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be current time stamp or a GUID. + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + /// Maximum allowed script execution time specified in ISO 8601 format. Default value is PT1H. + internal AzurePowerShellScriptProperties(ContainerConfiguration containerSettings, StorageAccountConfiguration storageAccountSettings, CleanupOptions? cleanupPreference, ScriptProvisioningState? provisioningState, ScriptStatus status, IDictionary outputs, string azPowerShellVersion, string primaryScriptUri, IList supportingScriptUris, string scriptContent, string arguments, IList environmentVariables, string forceUpdateTag, TimeSpan retentionInterval, TimeSpan? timeout) : base(containerSettings, storageAccountSettings, cleanupPreference, provisioningState, status, outputs) + { + AzPowerShellVersion = azPowerShellVersion; + PrimaryScriptUri = primaryScriptUri; + SupportingScriptUris = supportingScriptUris; + ScriptContent = scriptContent; + Arguments = arguments; + EnvironmentVariables = environmentVariables; + ForceUpdateTag = forceUpdateTag; + RetentionInterval = retentionInterval; + Timeout = timeout; + } + + /// Azure PowerShell module version to be used. + public string AzPowerShellVersion { get; set; } + /// Uri for the script. This is the entry point for the external script. + public string PrimaryScriptUri { get; set; } + /// Supporting files for the external script. + public IList SupportingScriptUris { get; set; } + /// Script body. + public string ScriptContent { get; set; } + /// Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'. + public string Arguments { get; set; } + /// The environment variables to pass over to the script. + public IList EnvironmentVariables { get; set; } + /// Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be current time stamp or a GUID. + public string ForceUpdateTag { get; set; } + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + public TimeSpan RetentionInterval { get; set; } + /// Maximum allowed script execution time specified in ISO 8601 format. Default value is PT1H. + public TimeSpan? Timeout { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureResourceBase.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureResourceBase.Serialization.cs new file mode 100644 index 000000000000..3c7a9f591fcf --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureResourceBase.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class AzureResourceBase : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + writer.WriteEndObject(); + } + + internal static AzureResourceBase DeserializeAzureResourceBase(JsonElement element) + { + string id = default; + string name = default; + string type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + } + return new AzureResourceBase(id, name, type); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureResourceBase.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureResourceBase.cs new file mode 100644 index 000000000000..95427bd97dba --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/AzureResourceBase.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Common properties for all Azure resources. + public partial class AzureResourceBase + { + /// Initializes a new instance of AzureResourceBase. + public AzureResourceBase() + { + } + + /// Initializes a new instance of AzureResourceBase. + /// String Id used to locate any resource on Azure. + /// Name of this resource. + /// Type of this resource. + internal AzureResourceBase(string id, string name, string type) + { + Id = id; + Name = name; + Type = type; + } + + /// String Id used to locate any resource on Azure. + public string Id { get; } + /// Name of this resource. + public string Name { get; } + /// Type of this resource. + public string Type { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/BasicDependency.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/BasicDependency.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/BasicDependency.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/BasicDependency.Serialization.cs index 653421c51476..2d384e489e70 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/BasicDependency.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/BasicDependency.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class BasicDependency { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/BasicDependency.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/BasicDependency.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/BasicDependency.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/BasicDependency.cs index 72636b8631fa..c396807c5c20 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/BasicDependency.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/BasicDependency.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Deployment dependency information. public partial class BasicDependency diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ChangeType.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ChangeType.Serialization.cs new file mode 100644 index 000000000000..cdce3dc96e9a --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ChangeType.Serialization.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class ChangeTypeExtensions + { + public static string ToSerialString(this ChangeType value) => value switch + { + ChangeType.Create => "Create", + ChangeType.Delete => "Delete", + ChangeType.Ignore => "Ignore", + ChangeType.Deploy => "Deploy", + ChangeType.NoChange => "NoChange", + ChangeType.Modify => "Modify", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ChangeType value.") + }; + + public static ChangeType ToChangeType(this string value) + { + if (string.Equals(value, "Create", StringComparison.InvariantCultureIgnoreCase)) return ChangeType.Create; + if (string.Equals(value, "Delete", StringComparison.InvariantCultureIgnoreCase)) return ChangeType.Delete; + if (string.Equals(value, "Ignore", StringComparison.InvariantCultureIgnoreCase)) return ChangeType.Ignore; + if (string.Equals(value, "Deploy", StringComparison.InvariantCultureIgnoreCase)) return ChangeType.Deploy; + if (string.Equals(value, "NoChange", StringComparison.InvariantCultureIgnoreCase)) return ChangeType.NoChange; + if (string.Equals(value, "Modify", StringComparison.InvariantCultureIgnoreCase)) return ChangeType.Modify; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ChangeType value."); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ChangeType.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ChangeType.cs new file mode 100644 index 000000000000..e8cab10025cf --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ChangeType.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Type of change that will be made to the resource when the deployment is executed. + public enum ChangeType + { + /// The resource does not exist in the current state but is present in the desired state. The resource will be created when the deployment is executed. + Create, + /// The resource exists in the current state and is missing from the desired state. The resource will be deleted when the deployment is executed. + Delete, + /// The resource exists in the current state and is missing from the desired state. The resource will not be deployed or modified when the deployment is executed. + Ignore, + /// The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource may or may not change. + Deploy, + /// The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will not change. + NoChange, + /// The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will change. + Modify + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/CleanupOptions.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/CleanupOptions.cs new file mode 100644 index 000000000000..f9b94e03d813 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/CleanupOptions.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Management.Resources.Models +{ + /// The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. + public readonly partial struct CleanupOptions : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + public CleanupOptions(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AlwaysValue = "Always"; + private const string OnSuccessValue = "OnSuccess"; + private const string OnExpirationValue = "OnExpiration"; + + /// Always. + public static CleanupOptions Always { get; } = new CleanupOptions(AlwaysValue); + /// OnSuccess. + public static CleanupOptions OnSuccess { get; } = new CleanupOptions(OnSuccessValue); + /// OnExpiration. + public static CleanupOptions OnExpiration { get; } = new CleanupOptions(OnExpirationValue); + /// Determines if two values are the same. + public static bool operator ==(CleanupOptions left, CleanupOptions right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CleanupOptions left, CleanupOptions right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CleanupOptions(string value) => new CleanupOptions(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CleanupOptions other && Equals(other); + /// + public bool Equals(CleanupOptions 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/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/CloudError.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/CloudError.Serialization.cs similarity index 95% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/CloudError.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/CloudError.Serialization.cs index c3f1df9a3781..9ad53806052d 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/CloudError.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/CloudError.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class CloudError { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/CloudError.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/CloudError.cs similarity index 94% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/CloudError.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/CloudError.cs index 937b3b8f5541..42d839ebe9e0 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/CloudError.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/CloudError.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// An error response for a resource management request. public partial class CloudError diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ContainerConfiguration.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ContainerConfiguration.Serialization.cs new file mode 100644 index 000000000000..bcffe50c3068 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ContainerConfiguration.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ContainerConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (ContainerGroupName != null) + { + writer.WritePropertyName("containerGroupName"); + writer.WriteStringValue(ContainerGroupName); + } + writer.WriteEndObject(); + } + + internal static ContainerConfiguration DeserializeContainerConfiguration(JsonElement element) + { + string containerGroupName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("containerGroupName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerGroupName = property.Value.GetString(); + continue; + } + } + return new ContainerConfiguration(containerGroupName); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ContainerConfiguration.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ContainerConfiguration.cs new file mode 100644 index 000000000000..bed4a2f90c15 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ContainerConfiguration.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Settings to customize ACI container instance. + public partial class ContainerConfiguration + { + /// Initializes a new instance of ContainerConfiguration. + public ContainerConfiguration() + { + } + + /// Initializes a new instance of ContainerConfiguration. + /// Container group name, if not specified then the name will get auto-generated. Not specifying a 'containerGroupName' indicates the system to generate a unique name which might end up flagging an Azure Policy as non-compliant. Use 'containerGroupName' when you have an Azure Policy that expects a specific naming convention or when you want to fully control the name. 'containerGroupName' property must be between 1 and 63 characters long, must contain only lowercase letters, numbers, and dashes and it cannot start or end with a dash and consecutive dashes are not allowed. To specify a 'containerGroupName', add the following object to properties: { "containerSettings": { "containerGroupName": "contoso-container" } }. If you do not want to specify a 'containerGroupName' then do not add 'containerSettings' property. + internal ContainerConfiguration(string containerGroupName) + { + ContainerGroupName = containerGroupName; + } + + /// Container group name, if not specified then the name will get auto-generated. Not specifying a 'containerGroupName' indicates the system to generate a unique name which might end up flagging an Azure Policy as non-compliant. Use 'containerGroupName' when you have an Azure Policy that expects a specific naming convention or when you want to fully control the name. 'containerGroupName' property must be between 1 and 63 characters long, must contain only lowercase letters, numbers, and dashes and it cannot start or end with a dash and consecutive dashes are not allowed. To specify a 'containerGroupName', add the following object to properties: { "containerSettings": { "containerGroupName": "contoso-container" } }. If you do not want to specify a 'containerGroupName' then do not add 'containerSettings' property. + public string ContainerGroupName { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/CreatedByType.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/CreatedByType.cs new file mode 100644 index 000000000000..24f00544914a --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Management.Resources.Models +{ + /// The type of identity that created the resource. + public readonly partial struct CreatedByType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + public CreatedByType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UserValue = "User"; + private const string ApplicationValue = "Application"; + private const string ManagedIdentityValue = "ManagedIdentity"; + private const string KeyValue = "Key"; + + /// User. + public static CreatedByType User { get; } = new CreatedByType(UserValue); + /// Application. + public static CreatedByType Application { get; } = new CreatedByType(ApplicationValue); + /// ManagedIdentity. + public static CreatedByType ManagedIdentity { get; } = new CreatedByType(ManagedIdentityValue); + /// Key. + public static CreatedByType Key { get; } = new CreatedByType(KeyValue); + /// Determines if two values are the same. + public static bool operator ==(CreatedByType left, CreatedByType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CreatedByType left, CreatedByType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CreatedByType(string value) => new CreatedByType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CreatedByType other && Equals(other); + /// + public bool Equals(CreatedByType 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/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DebugSetting.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DebugSetting.Serialization.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DebugSetting.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/DebugSetting.Serialization.cs index 4eadfe9aa3e5..f1496dd6d3b1 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DebugSetting.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DebugSetting.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class DebugSetting : IUtf8JsonSerializable { diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DebugSetting.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DebugSetting.cs new file mode 100644 index 000000000000..cb596ca6656c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DebugSetting.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The debug setting. + public partial class DebugSetting + { + /// Initializes a new instance of DebugSetting. + public DebugSetting() + { + } + + /// Initializes a new instance of DebugSetting. + /// Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations. + internal DebugSetting(string detailLevel) + { + DetailLevel = detailLevel; + } + + /// Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations. + public string DetailLevel { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Dependency.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Dependency.Serialization.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Dependency.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/Dependency.Serialization.cs index c17bcf9a12f5..f7cc5c8ce22a 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Dependency.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Dependency.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class Dependency { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Dependency.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Dependency.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Dependency.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/Dependency.cs index 5a262d7eff63..311ee220aeee 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Dependency.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Dependency.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Deployment dependency information. public partial class Dependency diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Deployment.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Deployment.Serialization.cs new file mode 100644 index 000000000000..6c172c9420df --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Deployment.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.Management.Resources.Models +{ + public partial class Deployment : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Location != null) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Deployment.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Deployment.cs new file mode 100644 index 000000000000..09385b9b18ff --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Deployment.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Deployment operation parameters. + public partial class Deployment + { + /// Initializes a new instance of Deployment. + /// The deployment properties. + public Deployment(DeploymentProperties properties) + { + if (properties == null) + { + throw new ArgumentNullException(nameof(properties)); + } + + Properties = properties; + } + + /// Initializes a new instance of Deployment. + /// The location to store the deployment data. + /// The deployment properties. + /// Deployment tags. + internal Deployment(string location, DeploymentProperties properties, IDictionary tags) + { + Location = location; + Properties = properties; + Tags = tags; + } + + /// The location to store the deployment data. + public string Location { get; set; } + /// The deployment properties. + public DeploymentProperties Properties { get; } + /// Deployment tags. + public IDictionary Tags { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExportResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExportResult.Serialization.cs similarity index 95% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExportResult.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExportResult.Serialization.cs index b69016d1df78..d734dbeb4a08 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExportResult.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExportResult.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class DeploymentExportResult { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExportResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExportResult.cs similarity index 94% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExportResult.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExportResult.cs index b39c0d7d89a2..a26c248cd399 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExportResult.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExportResult.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// The deployment export result. public partial class DeploymentExportResult diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExtended.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExtended.Serialization.cs new file mode 100644 index 000000000000..c67b2dd99068 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExtended.Serialization.cs @@ -0,0 +1,96 @@ +// 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.Management.Resources.Models +{ + public partial class DeploymentExtended + { + internal static DeploymentExtended DeserializeDeploymentExtended(JsonElement element) + { + string id = default; + string name = default; + string type = default; + string location = default; + DeploymentPropertiesExtended properties = default; + IReadOnlyDictionary tags = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DeploymentPropertiesExtended.DeserializeDeploymentPropertiesExtended(property.Value); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + } + return new DeploymentExtended(id, name, type, location, properties, tags); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExtended.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExtended.cs new file mode 100644 index 000000000000..f23e5ba6a87f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExtended.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Deployment information. + public partial class DeploymentExtended + { + /// Initializes a new instance of DeploymentExtended. + internal DeploymentExtended() + { + } + + /// Initializes a new instance of DeploymentExtended. + /// The ID of the deployment. + /// The name of the deployment. + /// The type of the deployment. + /// the location of the deployment. + /// Deployment properties. + /// Deployment tags. + internal DeploymentExtended(string id, string name, string type, string location, DeploymentPropertiesExtended properties, IReadOnlyDictionary tags) + { + Id = id; + Name = name; + Type = type; + Location = location; + Properties = properties; + Tags = tags; + } + + /// The ID of the deployment. + public string Id { get; } + /// The name of the deployment. + public string Name { get; } + /// The type of the deployment. + public string Type { get; } + /// the location of the deployment. + public string Location { get; } + /// Deployment properties. + public DeploymentPropertiesExtended Properties { get; } + /// Deployment tags. + public IReadOnlyDictionary Tags { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExtendedFilter.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExtendedFilter.cs similarity index 94% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExtendedFilter.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExtendedFilter.cs index 1a55f40488ec..ed4f3c959f0f 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExtendedFilter.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentExtendedFilter.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Deployment filter. internal partial class DeploymentExtendedFilter diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentListResult.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentListResult.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentListResult.Serialization.cs index 92b45b88fd7b..fe724488c1d5 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentListResult.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentListResult.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class DeploymentListResult { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentListResult.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentListResult.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentListResult.cs index 6b845de3d6d7..78b18e25d026 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentListResult.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentListResult.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// List of deployments. public partial class DeploymentListResult diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentMode.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentMode.Serialization.cs similarity index 95% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentMode.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentMode.Serialization.cs index 04c4807638c7..ac96c28fe784 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentMode.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentMode.Serialization.cs @@ -7,7 +7,7 @@ using System; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { internal static class DeploymentModeExtensions { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentMode.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentMode.cs similarity index 94% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentMode.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentMode.cs index a0feb27f0e71..afdf2666a3d4 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentMode.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentMode.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. public enum DeploymentMode diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperation.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperation.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperation.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperation.Serialization.cs index b00c4a0f496e..3557a7305dc0 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperation.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperation.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class DeploymentOperation { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperation.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperation.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperation.cs index 1a2fd97457b8..9732b34a36ef 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperation.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperation.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Deployment operation information. public partial class DeploymentOperation diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperationProperties.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperationProperties.Serialization.cs new file mode 100644 index 000000000000..15c170329b8f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperationProperties.Serialization.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class DeploymentOperationProperties + { + internal static DeploymentOperationProperties DeserializeDeploymentOperationProperties(JsonElement element) + { + ProvisioningOperation? provisioningOperation = default; + string provisioningState = default; + DateTimeOffset? timestamp = default; + string duration = default; + string serviceRequestId = default; + string statusCode = default; + object statusMessage = default; + TargetResource targetResource = default; + HttpMessage request = default; + HttpMessage response = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningOperation")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningOperation = property.Value.GetString().ToProvisioningOperation(); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = property.Value.GetString(); + continue; + } + if (property.NameEquals("timestamp")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("duration")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + duration = property.Value.GetString(); + continue; + } + if (property.NameEquals("serviceRequestId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceRequestId = property.Value.GetString(); + continue; + } + if (property.NameEquals("statusCode")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statusCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("statusMessage")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statusMessage = property.Value.GetObject(); + continue; + } + if (property.NameEquals("targetResource")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetResource = TargetResource.DeserializeTargetResource(property.Value); + continue; + } + if (property.NameEquals("request")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + request = HttpMessage.DeserializeHttpMessage(property.Value); + continue; + } + if (property.NameEquals("response")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + response = HttpMessage.DeserializeHttpMessage(property.Value); + continue; + } + } + return new DeploymentOperationProperties(provisioningOperation, provisioningState, timestamp, duration, serviceRequestId, statusCode, statusMessage, targetResource, request, response); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperationProperties.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperationProperties.cs new file mode 100644 index 000000000000..113ad68cb3f3 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperationProperties.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// Deployment operation properties. + public partial class DeploymentOperationProperties + { + /// Initializes a new instance of DeploymentOperationProperties. + internal DeploymentOperationProperties() + { + } + + /// Initializes a new instance of DeploymentOperationProperties. + /// The name of the current provisioning operation. + /// The state of the provisioning. + /// The date and time of the operation. + /// The duration of the operation. + /// Deployment operation service request id. + /// Operation status code. + /// Operation status message. + /// The target resource. + /// The HTTP request message. + /// The HTTP response message. + internal DeploymentOperationProperties(ProvisioningOperation? provisioningOperation, string provisioningState, DateTimeOffset? timestamp, string duration, string serviceRequestId, string statusCode, object statusMessage, TargetResource targetResource, HttpMessage request, HttpMessage response) + { + ProvisioningOperation = provisioningOperation; + ProvisioningState = provisioningState; + Timestamp = timestamp; + Duration = duration; + ServiceRequestId = serviceRequestId; + StatusCode = statusCode; + StatusMessage = statusMessage; + TargetResource = targetResource; + Request = request; + Response = response; + } + + /// The name of the current provisioning operation. + public ProvisioningOperation? ProvisioningOperation { get; } + /// The state of the provisioning. + public string ProvisioningState { get; } + /// The date and time of the operation. + public DateTimeOffset? Timestamp { get; } + /// The duration of the operation. + public string Duration { get; } + /// Deployment operation service request id. + public string ServiceRequestId { get; } + /// Operation status code. + public string StatusCode { get; } + /// Operation status message. + public object StatusMessage { get; } + /// The target resource. + public TargetResource TargetResource { get; } + /// The HTTP request message. + public HttpMessage Request { get; } + /// The HTTP response message. + public HttpMessage Response { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperationsListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperationsListResult.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperationsListResult.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperationsListResult.Serialization.cs index 8e7c074e7d7b..cf43cdd28335 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperationsListResult.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperationsListResult.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class DeploymentOperationsListResult { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperationsListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperationsListResult.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperationsListResult.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperationsListResult.cs index 2bf8a6346137..32b59fb928aa 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperationsListResult.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentOperationsListResult.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// List of deployment operations. public partial class DeploymentOperationsListResult diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentProperties.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentProperties.Serialization.cs new file mode 100644 index 000000000000..6a96db66afd2 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentProperties.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.Management.Resources.Models +{ + public partial class DeploymentProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Template != null) + { + writer.WritePropertyName("template"); + writer.WriteObjectValue(Template); + } + if (TemplateLink != null) + { + writer.WritePropertyName("templateLink"); + writer.WriteObjectValue(TemplateLink); + } + if (Parameters != null) + { + writer.WritePropertyName("parameters"); + writer.WriteObjectValue(Parameters); + } + if (ParametersLink != null) + { + writer.WritePropertyName("parametersLink"); + writer.WriteObjectValue(ParametersLink); + } + writer.WritePropertyName("mode"); + writer.WriteStringValue(Mode.ToSerialString()); + if (DebugSetting != null) + { + writer.WritePropertyName("debugSetting"); + writer.WriteObjectValue(DebugSetting); + } + if (OnErrorDeployment != null) + { + writer.WritePropertyName("onErrorDeployment"); + writer.WriteObjectValue(OnErrorDeployment); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentProperties.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentProperties.cs new file mode 100644 index 000000000000..9820345b367c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentProperties.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Deployment properties. + public partial class DeploymentProperties + { + /// Initializes a new instance of DeploymentProperties. + /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + public DeploymentProperties(DeploymentMode mode) + { + Mode = mode; + } + + /// Initializes a new instance of DeploymentProperties. + /// The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + /// The URI of the template. Use either the templateLink property or the template property, but not both. + /// Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + /// The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + /// The debug setting of the deployment. + /// The deployment on error behavior. + internal DeploymentProperties(object template, TemplateLink templateLink, object parameters, ParametersLink parametersLink, DeploymentMode mode, DebugSetting debugSetting, OnErrorDeployment onErrorDeployment) + { + Template = template; + TemplateLink = templateLink; + Parameters = parameters; + ParametersLink = parametersLink; + Mode = mode; + DebugSetting = debugSetting; + OnErrorDeployment = onErrorDeployment; + } + + /// The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + public object Template { get; set; } + /// The URI of the template. Use either the templateLink property or the template property, but not both. + public TemplateLink TemplateLink { get; set; } + /// Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + public object Parameters { get; set; } + /// The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + public ParametersLink ParametersLink { get; set; } + /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + public DeploymentMode Mode { get; } + /// The debug setting of the deployment. + public DebugSetting DebugSetting { get; set; } + /// The deployment on error behavior. + public OnErrorDeployment OnErrorDeployment { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentPropertiesExtended.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentPropertiesExtended.Serialization.cs new file mode 100644 index 000000000000..aafdadf18b8f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentPropertiesExtended.Serialization.cs @@ -0,0 +1,243 @@ +// 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; + +namespace Azure.Management.Resources.Models +{ + public partial class DeploymentPropertiesExtended + { + internal static DeploymentPropertiesExtended DeserializeDeploymentPropertiesExtended(JsonElement element) + { + string provisioningState = default; + string correlationId = default; + DateTimeOffset? timestamp = default; + string duration = default; + object outputs = default; + IReadOnlyList providers = default; + IReadOnlyList dependencies = default; + TemplateLink templateLink = default; + object parameters = default; + ParametersLink parametersLink = default; + DeploymentMode? mode = default; + DebugSetting debugSetting = default; + OnErrorDeploymentExtended onErrorDeployment = default; + string templateHash = default; + IReadOnlyList outputResources = default; + IReadOnlyList validatedResources = default; + ErrorResponse error = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + correlationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("timestamp")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("duration")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + duration = property.Value.GetString(); + continue; + } + if (property.NameEquals("outputs")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + outputs = property.Value.GetObject(); + continue; + } + if (property.NameEquals("providers")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(Provider.DeserializeProvider(item)); + } + } + providers = array; + continue; + } + if (property.NameEquals("dependencies")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(Dependency.DeserializeDependency(item)); + } + } + dependencies = array; + continue; + } + if (property.NameEquals("templateLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateLink = TemplateLink.DeserializeTemplateLink(property.Value); + continue; + } + if (property.NameEquals("parameters")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = property.Value.GetObject(); + continue; + } + if (property.NameEquals("parametersLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parametersLink = ParametersLink.DeserializeParametersLink(property.Value); + continue; + } + if (property.NameEquals("mode")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = property.Value.GetString().ToDeploymentMode(); + continue; + } + if (property.NameEquals("debugSetting")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + debugSetting = DebugSetting.DeserializeDebugSetting(property.Value); + continue; + } + if (property.NameEquals("onErrorDeployment")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + onErrorDeployment = OnErrorDeploymentExtended.DeserializeOnErrorDeploymentExtended(property.Value); + continue; + } + if (property.NameEquals("templateHash")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateHash = property.Value.GetString(); + continue; + } + if (property.NameEquals("outputResources")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ResourceReference.DeserializeResourceReference(item)); + } + } + outputResources = array; + continue; + } + if (property.NameEquals("validatedResources")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ResourceReference.DeserializeResourceReference(item)); + } + } + validatedResources = array; + continue; + } + if (property.NameEquals("error")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ErrorResponse.DeserializeErrorResponse(property.Value); + continue; + } + } + return new DeploymentPropertiesExtended(provisioningState, correlationId, timestamp, duration, outputs, providers, dependencies, templateLink, parameters, parametersLink, mode, debugSetting, onErrorDeployment, templateHash, outputResources, validatedResources, error); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentPropertiesExtended.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentPropertiesExtended.cs new file mode 100644 index 000000000000..2f4651c228a2 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentPropertiesExtended.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Deployment properties with additional details. + public partial class DeploymentPropertiesExtended + { + /// Initializes a new instance of DeploymentPropertiesExtended. + internal DeploymentPropertiesExtended() + { + } + + /// Initializes a new instance of DeploymentPropertiesExtended. + /// The state of the provisioning. + /// The correlation ID of the deployment. + /// The timestamp of the template deployment. + /// The duration of the template deployment. + /// Key/value pairs that represent deployment output. + /// The list of resource providers needed for the deployment. + /// The list of deployment dependencies. + /// The URI referencing the template. + /// Deployment parameters. + /// The URI referencing the parameters. + /// The deployment mode. Possible values are Incremental and Complete. + /// The debug setting of the deployment. + /// The deployment on error behavior. + /// The hash produced for the template. + /// Array of provisioned resources. + /// Array of validated resources. + /// The deployment error. + internal DeploymentPropertiesExtended(string provisioningState, string correlationId, DateTimeOffset? timestamp, string duration, object outputs, IReadOnlyList providers, IReadOnlyList dependencies, TemplateLink templateLink, object parameters, ParametersLink parametersLink, DeploymentMode? mode, DebugSetting debugSetting, OnErrorDeploymentExtended onErrorDeployment, string templateHash, IReadOnlyList outputResources, IReadOnlyList validatedResources, ErrorResponse error) + { + ProvisioningState = provisioningState; + CorrelationId = correlationId; + Timestamp = timestamp; + Duration = duration; + Outputs = outputs; + Providers = providers; + Dependencies = dependencies; + TemplateLink = templateLink; + Parameters = parameters; + ParametersLink = parametersLink; + Mode = mode; + DebugSetting = debugSetting; + OnErrorDeployment = onErrorDeployment; + TemplateHash = templateHash; + OutputResources = outputResources; + ValidatedResources = validatedResources; + Error = error; + } + + /// The state of the provisioning. + public string ProvisioningState { get; } + /// The correlation ID of the deployment. + public string CorrelationId { get; } + /// The timestamp of the template deployment. + public DateTimeOffset? Timestamp { get; } + /// The duration of the template deployment. + public string Duration { get; } + /// Key/value pairs that represent deployment output. + public object Outputs { get; } + /// The list of resource providers needed for the deployment. + public IReadOnlyList Providers { get; } + /// The list of deployment dependencies. + public IReadOnlyList Dependencies { get; } + /// The URI referencing the template. + public TemplateLink TemplateLink { get; } + /// Deployment parameters. + public object Parameters { get; } + /// The URI referencing the parameters. + public ParametersLink ParametersLink { get; } + /// The deployment mode. Possible values are Incremental and Complete. + public DeploymentMode? Mode { get; } + /// The debug setting of the deployment. + public DebugSetting DebugSetting { get; } + /// The deployment on error behavior. + public OnErrorDeploymentExtended OnErrorDeployment { get; } + /// The hash produced for the template. + public string TemplateHash { get; } + /// Array of provisioned resources. + public IReadOnlyList OutputResources { get; } + /// Array of validated resources. + public IReadOnlyList ValidatedResources { get; } + /// The deployment error. + public ErrorResponse Error { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScript.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScript.Serialization.cs new file mode 100644 index 000000000000..1ce9608556e0 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScript.Serialization.cs @@ -0,0 +1,155 @@ +// 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.Management.Resources.Models +{ + public partial class DeploymentScript : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind.ToString()); + if (SystemData != null) + { + writer.WritePropertyName("systemData"); + writer.WriteObjectValue(SystemData); + } + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + writer.WriteEndObject(); + } + + internal static DeploymentScript DeserializeDeploymentScript(JsonElement element) + { + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AzureCLI": return AzureCliScript.DeserializeAzureCliScript(element); + case "AzurePowerShell": return AzurePowerShellScript.DeserializeAzurePowerShellScript(element); + } + } + ManagedServiceIdentity identity = default; + string location = default; + IDictionary tags = default; + ScriptType kind = default; + SystemData systemData = default; + string id = default; + string name = default; + string type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity")) + { + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (property.NameEquals("kind")) + { + kind = new ScriptType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = SystemData.DeserializeSystemData(property.Value); + continue; + } + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + } + return new DeploymentScript(id, name, type, identity, location, tags, kind, systemData); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScript.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScript.cs new file mode 100644 index 000000000000..8648b9eafbd1 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScript.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Deployment script object. + public partial class DeploymentScript : AzureResourceBase + { + /// Initializes a new instance of DeploymentScript. + /// Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported. + /// The location of the ACI and the storage account for the deployment script. + public DeploymentScript(ManagedServiceIdentity identity, string location) + { + if (identity == null) + { + throw new ArgumentNullException(nameof(identity)); + } + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + Identity = identity; + Location = location; + Kind = "DeploymentScript"; + } + + /// Initializes a new instance of DeploymentScript. + /// String Id used to locate any resource on Azure. + /// Name of this resource. + /// Type of this resource. + /// Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported. + /// The location of the ACI and the storage account for the deployment script. + /// Resource tags. + /// Type of the script. + /// The system metadata related to this resource. + internal DeploymentScript(string id, string name, string type, ManagedServiceIdentity identity, string location, IDictionary tags, ScriptType kind, SystemData systemData) : base(id, name, type) + { + Identity = identity; + Location = location; + Tags = tags; + Kind = kind; + SystemData = systemData; + } + + /// Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported. + public ManagedServiceIdentity Identity { get; set; } + /// The location of the ACI and the storage account for the deployment script. + public string Location { get; set; } + /// Resource tags. + public IDictionary Tags { get; set; } + /// Type of the script. + internal ScriptType Kind { get; set; } + /// The system metadata related to this resource. + public SystemData SystemData { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptListResult.Serialization.cs new file mode 100644 index 000000000000..1fc9a86c8fcb --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class DeploymentScriptListResult + { + internal static DeploymentScriptListResult DeserializeDeploymentScriptListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(DeploymentScript.DeserializeDeploymentScript(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new DeploymentScriptListResult(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptListResult.cs new file mode 100644 index 000000000000..72c19f4c9f1c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// List of deployment scripts. + public partial class DeploymentScriptListResult + { + /// Initializes a new instance of DeploymentScriptListResult. + internal DeploymentScriptListResult() + { + } + + /// Initializes a new instance of DeploymentScriptListResult. + /// An array of deployment scripts. + /// The URL to use for getting the next set of results. + internal DeploymentScriptListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of deployment scripts. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptPropertiesBase.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptPropertiesBase.Serialization.cs new file mode 100644 index 000000000000..9c491b2afa7c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptPropertiesBase.Serialization.cs @@ -0,0 +1,138 @@ +// 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.Management.Resources.Models +{ + public partial class DeploymentScriptPropertiesBase : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (ContainerSettings != null) + { + writer.WritePropertyName("containerSettings"); + writer.WriteObjectValue(ContainerSettings); + } + if (StorageAccountSettings != null) + { + writer.WritePropertyName("storageAccountSettings"); + writer.WriteObjectValue(StorageAccountSettings); + } + if (CleanupPreference != null) + { + writer.WritePropertyName("cleanupPreference"); + writer.WriteStringValue(CleanupPreference.Value.ToString()); + } + if (ProvisioningState != null) + { + writer.WritePropertyName("provisioningState"); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Status != null) + { + writer.WritePropertyName("status"); + writer.WriteObjectValue(Status); + } + if (Outputs != null) + { + writer.WritePropertyName("outputs"); + writer.WriteStartObject(); + foreach (var item in Outputs) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static DeploymentScriptPropertiesBase DeserializeDeploymentScriptPropertiesBase(JsonElement element) + { + ContainerConfiguration containerSettings = default; + StorageAccountConfiguration storageAccountSettings = default; + CleanupOptions? cleanupPreference = default; + ScriptProvisioningState? provisioningState = default; + ScriptStatus status = default; + IDictionary outputs = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("containerSettings")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerSettings = ContainerConfiguration.DeserializeContainerConfiguration(property.Value); + continue; + } + if (property.NameEquals("storageAccountSettings")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageAccountSettings = StorageAccountConfiguration.DeserializeStorageAccountConfiguration(property.Value); + continue; + } + if (property.NameEquals("cleanupPreference")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cleanupPreference = new CleanupOptions(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ScriptProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = ScriptStatus.DeserializeScriptStatus(property.Value); + continue; + } + if (property.NameEquals("outputs")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetObject()); + } + } + outputs = dictionary; + continue; + } + } + return new DeploymentScriptPropertiesBase(containerSettings, storageAccountSettings, cleanupPreference, provisioningState, status, outputs); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptPropertiesBase.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptPropertiesBase.cs new file mode 100644 index 000000000000..5466c3662db4 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptPropertiesBase.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Common properties for the deployment script. + public partial class DeploymentScriptPropertiesBase + { + /// Initializes a new instance of DeploymentScriptPropertiesBase. + public DeploymentScriptPropertiesBase() + { + } + + /// Initializes a new instance of DeploymentScriptPropertiesBase. + /// Container settings. + /// Storage Account settings. + /// The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. + /// State of the script execution. This only appears in the response. + /// Contains the results of script execution. + /// List of script outputs. + internal DeploymentScriptPropertiesBase(ContainerConfiguration containerSettings, StorageAccountConfiguration storageAccountSettings, CleanupOptions? cleanupPreference, ScriptProvisioningState? provisioningState, ScriptStatus status, IDictionary outputs) + { + ContainerSettings = containerSettings; + StorageAccountSettings = storageAccountSettings; + CleanupPreference = cleanupPreference; + ProvisioningState = provisioningState; + Status = status; + Outputs = outputs; + } + + /// Container settings. + public ContainerConfiguration ContainerSettings { get; set; } + /// Storage Account settings. + public StorageAccountConfiguration StorageAccountSettings { get; set; } + /// The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. + public CleanupOptions? CleanupPreference { get; set; } + /// State of the script execution. This only appears in the response. + public ScriptProvisioningState? ProvisioningState { get; } + /// Contains the results of script execution. + public ScriptStatus Status { get; } + /// List of script outputs. + public IDictionary Outputs { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptUpdateParameter.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptUpdateParameter.Serialization.cs new file mode 100644 index 000000000000..87bc74b1a22d --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptUpdateParameter.Serialization.cs @@ -0,0 +1,108 @@ +// 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.Management.Resources.Models +{ + public partial class DeploymentScriptUpdateParameter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + writer.WriteEndObject(); + } + + internal static DeploymentScriptUpdateParameter DeserializeDeploymentScriptUpdateParameter(JsonElement element) + { + IDictionary tags = default; + string id = default; + string name = default; + string type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + } + return new DeploymentScriptUpdateParameter(id, name, type, tags); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptUpdateParameter.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptUpdateParameter.cs new file mode 100644 index 000000000000..bf6581ba9a8c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptUpdateParameter.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Deployment script parameters to be updated. + public partial class DeploymentScriptUpdateParameter : AzureResourceBase + { + /// Initializes a new instance of DeploymentScriptUpdateParameter. + public DeploymentScriptUpdateParameter() + { + } + + /// Initializes a new instance of DeploymentScriptUpdateParameter. + /// String Id used to locate any resource on Azure. + /// Name of this resource. + /// Type of this resource. + /// Resource tags to be updated. + internal DeploymentScriptUpdateParameter(string id, string name, string type, IDictionary tags) : base(id, name, type) + { + Tags = tags; + } + + /// Resource tags to be updated. + public IDictionary Tags { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptsError.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptsError.Serialization.cs new file mode 100644 index 000000000000..47cfcc43c4d6 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptsError.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class DeploymentScriptsError + { + internal static DeploymentScriptsError DeserializeDeploymentScriptsError(JsonElement element) + { + ErrorResponse error = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("error")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ErrorResponse.DeserializeErrorResponse(property.Value); + continue; + } + } + return new DeploymentScriptsError(error); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptsError.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptsError.cs new file mode 100644 index 000000000000..b6c0ab92aa7d --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentScriptsError.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Deployment scripts error response. + public partial class DeploymentScriptsError + { + /// Initializes a new instance of DeploymentScriptsError. + internal DeploymentScriptsError() + { + } + + /// Initializes a new instance of DeploymentScriptsError. + /// The resource management error response. + internal DeploymentScriptsError(ErrorResponse error) + { + Error = error; + } + + /// The resource management error response. + public ErrorResponse Error { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentValidateResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentValidateResult.Serialization.cs new file mode 100644 index 000000000000..62e744a2248b --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentValidateResult.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class DeploymentValidateResult + { + internal static DeploymentValidateResult DeserializeDeploymentValidateResult(JsonElement element) + { + ErrorResponse error = default; + DeploymentPropertiesExtended properties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("error")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ErrorResponse.DeserializeErrorResponse(property.Value); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DeploymentPropertiesExtended.DeserializeDeploymentPropertiesExtended(property.Value); + continue; + } + } + return new DeploymentValidateResult(error, properties); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentValidateResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentValidateResult.cs new file mode 100644 index 000000000000..2666352db0c4 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentValidateResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Information from validate template deployment response. + public partial class DeploymentValidateResult + { + /// Initializes a new instance of DeploymentValidateResult. + internal DeploymentValidateResult() + { + } + + /// Initializes a new instance of DeploymentValidateResult. + /// The deployment validation error. + /// The template deployment properties. + internal DeploymentValidateResult(ErrorResponse error, DeploymentPropertiesExtended properties) + { + Error = error; + Properties = properties; + } + + /// The deployment validation error. + public ErrorResponse Error { get; } + /// The template deployment properties. + public DeploymentPropertiesExtended Properties { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIf.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIf.Serialization.cs new file mode 100644 index 000000000000..570581cbbc51 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIf.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class DeploymentWhatIf : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Location != null) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIf.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIf.cs new file mode 100644 index 000000000000..fb3756db288c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIf.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// Deployment What-if operation parameters. + public partial class DeploymentWhatIf + { + /// Initializes a new instance of DeploymentWhatIf. + /// The deployment properties. + public DeploymentWhatIf(DeploymentWhatIfProperties properties) + { + if (properties == null) + { + throw new ArgumentNullException(nameof(properties)); + } + + Properties = properties; + } + + /// Initializes a new instance of DeploymentWhatIf. + /// The location to store the deployment data. + /// The deployment properties. + internal DeploymentWhatIf(string location, DeploymentWhatIfProperties properties) + { + Location = location; + Properties = properties; + } + + /// The location to store the deployment data. + public string Location { get; set; } + /// The deployment properties. + public DeploymentWhatIfProperties Properties { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIfProperties.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIfProperties.Serialization.cs new file mode 100644 index 000000000000..eb9a2664db44 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIfProperties.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class DeploymentWhatIfProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (WhatIfSettings != null) + { + writer.WritePropertyName("whatIfSettings"); + writer.WriteObjectValue(WhatIfSettings); + } + if (Template != null) + { + writer.WritePropertyName("template"); + writer.WriteObjectValue(Template); + } + if (TemplateLink != null) + { + writer.WritePropertyName("templateLink"); + writer.WriteObjectValue(TemplateLink); + } + if (Parameters != null) + { + writer.WritePropertyName("parameters"); + writer.WriteObjectValue(Parameters); + } + if (ParametersLink != null) + { + writer.WritePropertyName("parametersLink"); + writer.WriteObjectValue(ParametersLink); + } + writer.WritePropertyName("mode"); + writer.WriteStringValue(Mode.ToSerialString()); + if (DebugSetting != null) + { + writer.WritePropertyName("debugSetting"); + writer.WriteObjectValue(DebugSetting); + } + if (OnErrorDeployment != null) + { + writer.WritePropertyName("onErrorDeployment"); + writer.WriteObjectValue(OnErrorDeployment); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIfProperties.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIfProperties.cs new file mode 100644 index 000000000000..a3b091bf6edd --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIfProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Deployment What-if properties. + public partial class DeploymentWhatIfProperties : DeploymentProperties + { + /// Initializes a new instance of DeploymentWhatIfProperties. + /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + public DeploymentWhatIfProperties(DeploymentMode mode) : base(mode) + { + } + + /// Initializes a new instance of DeploymentWhatIfProperties. + /// The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + /// The URI of the template. Use either the templateLink property or the template property, but not both. + /// Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + /// The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + /// The debug setting of the deployment. + /// The deployment on error behavior. + /// Optional What-If operation settings. + internal DeploymentWhatIfProperties(object template, TemplateLink templateLink, object parameters, ParametersLink parametersLink, DeploymentMode mode, DebugSetting debugSetting, OnErrorDeployment onErrorDeployment, DeploymentWhatIfSettings whatIfSettings) : base(template, templateLink, parameters, parametersLink, mode, debugSetting, onErrorDeployment) + { + WhatIfSettings = whatIfSettings; + } + + /// Optional What-If operation settings. + public DeploymentWhatIfSettings WhatIfSettings { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIfSettings.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIfSettings.Serialization.cs new file mode 100644 index 000000000000..11e75137c500 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIfSettings.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.Management.Resources.Models +{ + public partial class DeploymentWhatIfSettings : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (ResultFormat != null) + { + writer.WritePropertyName("resultFormat"); + writer.WriteStringValue(ResultFormat.Value.ToSerialString()); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIfSettings.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIfSettings.cs new file mode 100644 index 000000000000..d4aa352cab40 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/DeploymentWhatIfSettings.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Deployment What-If operation settings. + public partial class DeploymentWhatIfSettings + { + /// Initializes a new instance of DeploymentWhatIfSettings. + public DeploymentWhatIfSettings() + { + } + + /// Initializes a new instance of DeploymentWhatIfSettings. + /// The format of the What-If results. + internal DeploymentWhatIfSettings(WhatIfResultFormat? resultFormat) + { + ResultFormat = resultFormat; + } + + /// The format of the What-If results. + public WhatIfResultFormat? ResultFormat { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/EnforcementMode.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/EnforcementMode.cs new file mode 100644 index 000000000000..877c901b0a45 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/EnforcementMode.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Management.Resources.Models +{ + /// The policy assignment enforcement mode. Possible values are Default and DoNotEnforce. + public readonly partial struct EnforcementMode : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + public EnforcementMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string DoNotEnforceValue = "DoNotEnforce"; + + /// The policy effect is enforced during resource creation or update. + public static EnforcementMode Default { get; } = new EnforcementMode(DefaultValue); + /// The policy effect is not enforced during resource creation or update. + public static EnforcementMode DoNotEnforce { get; } = new EnforcementMode(DoNotEnforceValue); + /// Determines if two values are the same. + public static bool operator ==(EnforcementMode left, EnforcementMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EnforcementMode left, EnforcementMode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EnforcementMode(string value) => new EnforcementMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EnforcementMode other && Equals(other); + /// + public bool Equals(EnforcementMode 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/resources/Azure.Management.Resources/src/Generated/Models/EnvironmentVariable.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/EnvironmentVariable.Serialization.cs new file mode 100644 index 000000000000..38cd5c2272e4 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/EnvironmentVariable.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.Management.Resources.Models +{ + public partial class EnvironmentVariable : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + if (Value != null) + { + writer.WritePropertyName("value"); + writer.WriteStringValue(Value); + } + if (SecureValue != null) + { + writer.WritePropertyName("secureValue"); + writer.WriteStringValue(SecureValue); + } + writer.WriteEndObject(); + } + + internal static EnvironmentVariable DeserializeEnvironmentVariable(JsonElement element) + { + string name = default; + string value = default; + string secureValue = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("secureValue")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + secureValue = property.Value.GetString(); + continue; + } + } + return new EnvironmentVariable(name, value, secureValue); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/EnvironmentVariable.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/EnvironmentVariable.cs new file mode 100644 index 000000000000..380b59f4e5b6 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/EnvironmentVariable.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// The environment variable to pass to the script in the container instance. + public partial class EnvironmentVariable + { + /// Initializes a new instance of EnvironmentVariable. + /// The name of the environment variable. + public EnvironmentVariable(string name) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + Name = name; + } + + /// Initializes a new instance of EnvironmentVariable. + /// The name of the environment variable. + /// The value of the environment variable. + /// The value of the secure environment variable. + internal EnvironmentVariable(string name, string value, string secureValue) + { + Name = name; + Value = value; + SecureValue = secureValue; + } + + /// The name of the environment variable. + public string Name { get; set; } + /// The value of the environment variable. + public string Value { get; set; } + /// The value of the secure environment variable. + public string SecureValue { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs new file mode 100644 index 000000000000..9dc899072a56 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorAdditionalInfo.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.Management.Resources.Models +{ + public partial class ErrorAdditionalInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + if (Info != null) + { + writer.WritePropertyName("info"); + writer.WriteObjectValue(Info); + } + writer.WriteEndObject(); + } + + internal static ErrorAdditionalInfo DeserializeErrorAdditionalInfo(JsonElement element) + { + string type = default; + object info = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("info")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + info = property.Value.GetObject(); + continue; + } + } + return new ErrorAdditionalInfo(type, info); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..3f04ef1f3838 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The resource management error additional info. + public partial class ErrorAdditionalInfo + { + /// Initializes a new instance of ErrorAdditionalInfo. + public ErrorAdditionalInfo() + { + } + + /// Initializes a new instance of ErrorAdditionalInfo. + /// The additional info type. + /// The additional info. + internal ErrorAdditionalInfo(string type, object info) + { + Type = type; + Info = info; + } + + /// The additional info type. + public string Type { get; } + /// The additional info. + public object Info { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorResponse.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorResponse.Serialization.cs new file mode 100644 index 000000000000..17e6bdfecc5e --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorResponse.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; + +namespace Azure.Management.Resources.Models +{ + public partial class ErrorResponse : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Code != null) + { + writer.WritePropertyName("code"); + writer.WriteStringValue(Code); + } + if (Message != null) + { + writer.WritePropertyName("message"); + writer.WriteStringValue(Message); + } + if (Target != null) + { + writer.WritePropertyName("target"); + writer.WriteStringValue(Target); + } + if (Details != null) + { + writer.WritePropertyName("details"); + writer.WriteStartArray(); + foreach (var item in Details) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (AdditionalInfo != null) + { + writer.WritePropertyName("additionalInfo"); + writer.WriteStartArray(); + foreach (var item in AdditionalInfo) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static ErrorResponse DeserializeErrorResponse(JsonElement element) + { + string code = default; + string message = default; + string target = default; + IList details = default; + IList additionalInfo = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("message")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("target")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + target = property.Value.GetString(); + continue; + } + if (property.NameEquals("details")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(DeserializeErrorResponse(item)); + } + } + details = array; + continue; + } + if (property.NameEquals("additionalInfo")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ErrorAdditionalInfo.DeserializeErrorAdditionalInfo(item)); + } + } + additionalInfo = array; + continue; + } + } + return new ErrorResponse(code, message, target, details, additionalInfo); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorResponse.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..06c1b27f3b7f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// The resource management error response. + public partial class ErrorResponse + { + /// Initializes a new instance of ErrorResponse. + public ErrorResponse() + { + } + + /// Initializes a new instance of ErrorResponse. + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + internal ErrorResponse(string code, string message, string target, IList details, IList additionalInfo) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + } + + /// The error code. + public string Code { get; } + /// The error message. + public string Message { get; } + /// The error target. + public string Target { get; } + /// The error details. + public IList Details { get; } + /// The error additional info. + public IList AdditionalInfo { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorResponseAutoGenerated.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorResponseAutoGenerated.Serialization.cs new file mode 100644 index 000000000000..9de500c4d1fa --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorResponseAutoGenerated.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.Management.Resources.Models +{ + public partial class ErrorResponseAutoGenerated + { + internal static ErrorResponseAutoGenerated DeserializeErrorResponseAutoGenerated(JsonElement element) + { + string httpStatus = default; + string errorCode = default; + string errorMessage = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("httpStatus")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + httpStatus = property.Value.GetString(); + continue; + } + if (property.NameEquals("errorCode")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + errorCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("errorMessage")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + errorMessage = property.Value.GetString(); + continue; + } + } + return new ErrorResponseAutoGenerated(httpStatus, errorCode, errorMessage); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorResponseAutoGenerated.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorResponseAutoGenerated.cs new file mode 100644 index 000000000000..db4756af33eb --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ErrorResponseAutoGenerated.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Error response indicates managed application is not able to process the incoming request. The reason is provided in the error message. + public partial class ErrorResponseAutoGenerated + { + /// Initializes a new instance of ErrorResponseAutoGenerated. + internal ErrorResponseAutoGenerated() + { + } + + /// Initializes a new instance of ErrorResponseAutoGenerated. + /// Http status code. + /// Error code. + /// Error message indicating why the operation failed. + internal ErrorResponseAutoGenerated(string httpStatus, string errorCode, string errorMessage) + { + HttpStatus = httpStatus; + ErrorCode = errorCode; + ErrorMessage = errorMessage; + } + + /// Http status code. + public string HttpStatus { get; } + /// Error code. + public string ErrorCode { get; } + /// Error message indicating why the operation failed. + public string ErrorMessage { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ExportTemplateRequest.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ExportTemplateRequest.Serialization.cs similarity index 95% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ExportTemplateRequest.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ExportTemplateRequest.Serialization.cs index 1dcbdca4bee0..5b24612494e3 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ExportTemplateRequest.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ExportTemplateRequest.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ExportTemplateRequest : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ExportTemplateRequest.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ExportTemplateRequest.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ExportTemplateRequest.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ExportTemplateRequest.cs index 4f2bf5fbc578..becc75048e41 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ExportTemplateRequest.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ExportTemplateRequest.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Export resource group template request parameters. public partial class ExportTemplateRequest diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureOperationsListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureOperationsListResult.Serialization.cs new file mode 100644 index 000000000000..63efca4b86b3 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureOperationsListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class FeatureOperationsListResult + { + internal static FeatureOperationsListResult DeserializeFeatureOperationsListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(FeatureResult.DeserializeFeatureResult(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new FeatureOperationsListResult(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureOperationsListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureOperationsListResult.cs new file mode 100644 index 000000000000..afde3e0f2d4f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureOperationsListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// List of previewed features. + public partial class FeatureOperationsListResult + { + /// Initializes a new instance of FeatureOperationsListResult. + internal FeatureOperationsListResult() + { + } + + /// Initializes a new instance of FeatureOperationsListResult. + /// The array of features. + /// The URL to use for getting the next set of results. + internal FeatureOperationsListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The array of features. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureProperties.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureProperties.Serialization.cs new file mode 100644 index 000000000000..c2efbbf4eb4e --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureProperties.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class FeatureProperties + { + internal static FeatureProperties DeserializeFeatureProperties(JsonElement element) + { + string state = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("state")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = property.Value.GetString(); + continue; + } + } + return new FeatureProperties(state); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureProperties.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureProperties.cs new file mode 100644 index 000000000000..2aefba210965 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureProperties.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Information about feature. + public partial class FeatureProperties + { + /// Initializes a new instance of FeatureProperties. + internal FeatureProperties() + { + } + + /// Initializes a new instance of FeatureProperties. + /// The registration state of the feature for the subscription. + internal FeatureProperties(string state) + { + State = state; + } + + /// The registration state of the feature for the subscription. + public string State { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureResult.Serialization.cs new file mode 100644 index 000000000000..777860a20a23 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureResult.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class FeatureResult + { + internal static FeatureResult DeserializeFeatureResult(JsonElement element) + { + string name = default; + FeatureProperties properties = default; + string id = default; + string type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = FeatureProperties.DeserializeFeatureProperties(property.Value); + continue; + } + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + } + return new FeatureResult(name, properties, id, type); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureResult.cs new file mode 100644 index 000000000000..939f5fa92fd9 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/FeatureResult.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Previewed feature information. + public partial class FeatureResult + { + /// Initializes a new instance of FeatureResult. + internal FeatureResult() + { + } + + /// Initializes a new instance of FeatureResult. + /// The name of the feature. + /// Properties of the previewed feature. + /// The resource ID of the feature. + /// The resource type of the feature. + internal FeatureResult(string name, FeatureProperties properties, string id, string type) + { + Name = name; + Properties = properties; + Id = id; + Type = type; + } + + /// The name of the feature. + public string Name { get; } + /// Properties of the previewed feature. + public FeatureProperties Properties { get; } + /// The resource ID of the feature. + public string Id { get; } + /// The resource type of the feature. + public string Type { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResource.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResource.Serialization.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResource.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResource.Serialization.cs index 498b4777a96b..c82bc40814d6 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResource.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResource.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class GenericResource : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResource.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResource.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResource.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResource.cs index dadcfcc9e3b4..575d9f7e2513 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResource.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResource.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Resource information. public partial class GenericResource : Resource diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceAutoGenerated.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceAutoGenerated.Serialization.cs new file mode 100644 index 000000000000..2e3db9353e0a --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceAutoGenerated.Serialization.cs @@ -0,0 +1,168 @@ +// 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.Management.Resources.Models +{ + public partial class GenericResourceAutoGenerated : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (ManagedBy != null) + { + writer.WritePropertyName("managedBy"); + writer.WriteStringValue(ManagedBy); + } + if (Sku != null) + { + writer.WritePropertyName("sku"); + writer.WriteObjectValue(Sku); + } + if (Identity != null) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + if (Location != null) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static GenericResourceAutoGenerated DeserializeGenericResourceAutoGenerated(JsonElement element) + { + string managedBy = default; + SkuAutoGenerated sku = default; + IdentityAutoGenerated2 identity = default; + string id = default; + string name = default; + string type = default; + string location = default; + IDictionary tags = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("managedBy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("sku")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = SkuAutoGenerated.DeserializeSkuAutoGenerated(property.Value); + continue; + } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = IdentityAutoGenerated2.DeserializeIdentityAutoGenerated2(property.Value); + continue; + } + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + } + return new GenericResourceAutoGenerated(id, name, type, location, tags, managedBy, sku, identity); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceAutoGenerated.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceAutoGenerated.cs new file mode 100644 index 000000000000..5e07ab4fef15 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceAutoGenerated.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Resource information. + public partial class GenericResourceAutoGenerated : Resource + { + /// Initializes a new instance of GenericResourceAutoGenerated. + public GenericResourceAutoGenerated() + { + } + + /// Initializes a new instance of GenericResourceAutoGenerated. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// ID of the resource that manages this resource. + /// The SKU of the resource. + /// The identity of the resource. + internal GenericResourceAutoGenerated(string id, string name, string type, string location, IDictionary tags, string managedBy, SkuAutoGenerated sku, IdentityAutoGenerated2 identity) : base(id, name, type, location, tags) + { + ManagedBy = managedBy; + Sku = sku; + Identity = identity; + } + + /// ID of the resource that manages this resource. + public string ManagedBy { get; set; } + /// The SKU of the resource. + public SkuAutoGenerated Sku { get; set; } + /// The identity of the resource. + public IdentityAutoGenerated2 Identity { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResourceExpanded.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceExpanded.Serialization.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResourceExpanded.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceExpanded.Serialization.cs index 4b41b479a7c9..f86f445768b2 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResourceExpanded.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceExpanded.Serialization.cs @@ -10,7 +10,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class GenericResourceExpanded : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResourceExpanded.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceExpanded.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResourceExpanded.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceExpanded.cs index 41272369b141..83a3db87f10f 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResourceExpanded.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceExpanded.cs @@ -8,7 +8,7 @@ using System; using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Resource information. public partial class GenericResourceExpanded : GenericResource diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResourceFilter.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceFilter.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResourceFilter.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceFilter.cs index b8818b7c26ad..291512c8bde2 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/GenericResourceFilter.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/GenericResourceFilter.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Resource filter. internal partial class GenericResourceFilter diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/HttpMessage.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/HttpMessage.Serialization.cs similarity index 94% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/HttpMessage.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/HttpMessage.Serialization.cs index d32cb7939df0..ea6e0a352373 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/HttpMessage.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/HttpMessage.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class HttpMessage { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/HttpMessage.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/HttpMessage.cs similarity index 94% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/HttpMessage.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/HttpMessage.cs index d27db3b5aad8..4e5437397eab 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/HttpMessage.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/HttpMessage.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// HTTP message. public partial class HttpMessage diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Identity.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Identity.Serialization.cs new file mode 100644 index 000000000000..8fa00a94e5e6 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Identity.Serialization.cs @@ -0,0 +1,108 @@ +// 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.Management.Resources.Models +{ + public partial class Identity : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (PrincipalId != null) + { + writer.WritePropertyName("principalId"); + writer.WriteStringValue(PrincipalId); + } + if (TenantId != null) + { + writer.WritePropertyName("tenantId"); + writer.WriteStringValue(TenantId); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.Value.ToSerialString()); + } + if (UserAssignedIdentities != null) + { + writer.WritePropertyName("userAssignedIdentities"); + writer.WriteStartObject(); + foreach (var item in UserAssignedIdentities) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static Identity DeserializeIdentity(JsonElement element) + { + string principalId = default; + string tenantId = default; + ResourceIdentityType? type = default; + IDictionary userAssignedIdentities = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + principalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString().ToResourceIdentityType(); + continue; + } + if (property.NameEquals("userAssignedIdentities")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, IdentityUserAssignedIdentitiesValue.DeserializeIdentityUserAssignedIdentitiesValue(property0.Value)); + } + } + userAssignedIdentities = dictionary; + continue; + } + } + return new Identity(principalId, tenantId, type, userAssignedIdentities); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Identity.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Identity.cs new file mode 100644 index 000000000000..ebcd8f5d512f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Identity.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Identity for the resource. + public partial class Identity + { + /// Initializes a new instance of Identity. + public Identity() + { + } + + /// Initializes a new instance of Identity. + /// The principal ID of resource identity. + /// The tenant ID of resource. + /// The identity type. + /// The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + internal Identity(string principalId, string tenantId, ResourceIdentityType? type, IDictionary userAssignedIdentities) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + UserAssignedIdentities = userAssignedIdentities; + } + + /// The principal ID of resource identity. + public string PrincipalId { get; } + /// The tenant ID of resource. + public string TenantId { get; } + /// The identity type. + public ResourceIdentityType? Type { get; set; } + /// The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public IDictionary UserAssignedIdentities { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityAutoGenerated.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityAutoGenerated.Serialization.cs new file mode 100644 index 000000000000..e567b51ed371 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityAutoGenerated.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class IdentityAutoGenerated : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (PrincipalId != null) + { + writer.WritePropertyName("principalId"); + writer.WriteStringValue(PrincipalId); + } + if (TenantId != null) + { + writer.WritePropertyName("tenantId"); + writer.WriteStringValue(TenantId); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.Value.ToSerialString()); + } + writer.WriteEndObject(); + } + + internal static IdentityAutoGenerated DeserializeIdentityAutoGenerated(JsonElement element) + { + string principalId = default; + string tenantId = default; + ResourceIdentityType? type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + principalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString().ToResourceIdentityType(); + continue; + } + } + return new IdentityAutoGenerated(principalId, tenantId, type); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityAutoGenerated.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityAutoGenerated.cs new file mode 100644 index 000000000000..d5330517929c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityAutoGenerated.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Identity for the resource. + public partial class IdentityAutoGenerated + { + /// Initializes a new instance of IdentityAutoGenerated. + public IdentityAutoGenerated() + { + } + + /// Initializes a new instance of IdentityAutoGenerated. + /// The principal ID of the resource identity. + /// The tenant ID of the resource identity. + /// The identity type. This is the only required field when adding a system assigned identity to a resource. + internal IdentityAutoGenerated(string principalId, string tenantId, ResourceIdentityType? type) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + } + + /// The principal ID of the resource identity. + public string PrincipalId { get; } + /// The tenant ID of the resource identity. + public string TenantId { get; } + /// The identity type. This is the only required field when adding a system assigned identity to a resource. + public ResourceIdentityType? Type { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityAutoGenerated2.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityAutoGenerated2.Serialization.cs new file mode 100644 index 000000000000..84d0b0bf5fd4 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityAutoGenerated2.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class IdentityAutoGenerated2 : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (PrincipalId != null) + { + writer.WritePropertyName("principalId"); + writer.WriteStringValue(PrincipalId); + } + if (TenantId != null) + { + writer.WritePropertyName("tenantId"); + writer.WriteStringValue(TenantId); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.Value.ToSerialString()); + } + writer.WriteEndObject(); + } + + internal static IdentityAutoGenerated2 DeserializeIdentityAutoGenerated2(JsonElement element) + { + string principalId = default; + string tenantId = default; + ResourceIdentityType? type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + principalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString().ToResourceIdentityType(); + continue; + } + } + return new IdentityAutoGenerated2(principalId, tenantId, type); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityAutoGenerated2.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityAutoGenerated2.cs new file mode 100644 index 000000000000..b211d142f433 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityAutoGenerated2.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Identity for the resource. + public partial class IdentityAutoGenerated2 + { + /// Initializes a new instance of IdentityAutoGenerated2. + public IdentityAutoGenerated2() + { + } + + /// Initializes a new instance of IdentityAutoGenerated2. + /// The principal ID of resource identity. + /// The tenant ID of resource. + /// The identity type. + internal IdentityAutoGenerated2(string principalId, string tenantId, ResourceIdentityType? type) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + } + + /// The principal ID of resource identity. + public string PrincipalId { get; } + /// The tenant ID of resource. + public string TenantId { get; } + /// The identity type. + public ResourceIdentityType? Type { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityUserAssignedIdentitiesValue.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityUserAssignedIdentitiesValue.Serialization.cs new file mode 100644 index 000000000000..6e313770d95d --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityUserAssignedIdentitiesValue.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.Management.Resources.Models +{ + public partial class IdentityUserAssignedIdentitiesValue : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (PrincipalId != null) + { + writer.WritePropertyName("principalId"); + writer.WriteStringValue(PrincipalId); + } + if (ClientId != null) + { + writer.WritePropertyName("clientId"); + writer.WriteStringValue(ClientId); + } + writer.WriteEndObject(); + } + + internal static IdentityUserAssignedIdentitiesValue DeserializeIdentityUserAssignedIdentitiesValue(JsonElement element) + { + string principalId = default; + string clientId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + principalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientId = property.Value.GetString(); + continue; + } + } + return new IdentityUserAssignedIdentitiesValue(principalId, clientId); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityUserAssignedIdentitiesValue.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityUserAssignedIdentitiesValue.cs new file mode 100644 index 000000000000..dc9b85516e3f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/IdentityUserAssignedIdentitiesValue.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The IdentityUserAssignedIdentitiesValue. + public partial class IdentityUserAssignedIdentitiesValue + { + /// Initializes a new instance of IdentityUserAssignedIdentitiesValue. + public IdentityUserAssignedIdentitiesValue() + { + } + + /// Initializes a new instance of IdentityUserAssignedIdentitiesValue. + /// The principal id of user assigned identity. + /// The client id of user assigned identity. + internal IdentityUserAssignedIdentitiesValue(string principalId, string clientId) + { + PrincipalId = principalId; + ClientId = clientId; + } + + /// The principal id of user assigned identity. + public string PrincipalId { get; } + /// The client id of user assigned identity. + public string ClientId { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Location.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Location.Serialization.cs new file mode 100644 index 000000000000..4142fdd7bf3f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Location.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.Management.Resources.Models +{ + public partial class Location + { + internal static Location DeserializeLocation(JsonElement element) + { + string id = default; + string subscriptionId = default; + string name = default; + string displayName = default; + string regionalDisplayName = default; + LocationMetadata metadata = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("regionalDisplayName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + regionalDisplayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("metadata")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metadata = LocationMetadata.DeserializeLocationMetadata(property.Value); + continue; + } + } + return new Location(id, subscriptionId, name, displayName, regionalDisplayName, metadata); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Location.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Location.cs new file mode 100644 index 000000000000..f056b0519d84 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Location.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Location information. + public partial class Location + { + /// Initializes a new instance of Location. + internal Location() + { + } + + /// Initializes a new instance of Location. + /// The fully qualified ID of the location. For example, /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. + /// The subscription ID. + /// The location name. + /// The display name of the location. + /// The display name of the location and its region. + /// Metadata of the location, such as lat/long, paired region, and others. + internal Location(string id, string subscriptionId, string name, string displayName, string regionalDisplayName, LocationMetadata metadata) + { + Id = id; + SubscriptionId = subscriptionId; + Name = name; + DisplayName = displayName; + RegionalDisplayName = regionalDisplayName; + Metadata = metadata; + } + + /// The fully qualified ID of the location. For example, /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. + public string Id { get; } + /// The subscription ID. + public string SubscriptionId { get; } + /// The location name. + public string Name { get; } + /// The display name of the location. + public string DisplayName { get; } + /// The display name of the location and its region. + public string RegionalDisplayName { get; } + /// Metadata of the location, such as lat/long, paired region, and others. + public LocationMetadata Metadata { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/LocationListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/LocationListResult.Serialization.cs new file mode 100644 index 000000000000..8fd79e43cb03 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/LocationListResult.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.Management.Resources.Models +{ + public partial class LocationListResult + { + internal static LocationListResult DeserializeLocationListResult(JsonElement element) + { + IReadOnlyList value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(Location.DeserializeLocation(item)); + } + } + value = array; + continue; + } + } + return new LocationListResult(value); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/LocationListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/LocationListResult.cs new file mode 100644 index 000000000000..ec5fcd68b468 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/LocationListResult.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Location list operation response. + public partial class LocationListResult + { + /// Initializes a new instance of LocationListResult. + internal LocationListResult() + { + } + + /// Initializes a new instance of LocationListResult. + /// An array of locations. + internal LocationListResult(IReadOnlyList value) + { + Value = value; + } + + /// An array of locations. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/LocationMetadata.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/LocationMetadata.Serialization.cs new file mode 100644 index 000000000000..4ee154dc0a90 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/LocationMetadata.Serialization.cs @@ -0,0 +1,106 @@ +// 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.Management.Resources.Models +{ + public partial class LocationMetadata + { + internal static LocationMetadata DeserializeLocationMetadata(JsonElement element) + { + RegionType? regionType = default; + RegionCategory? regionCategory = default; + string geographyGroup = default; + string longitude = default; + string latitude = default; + string physicalLocation = default; + IReadOnlyList pairedRegion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("regionType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + regionType = new RegionType(property.Value.GetString()); + continue; + } + if (property.NameEquals("regionCategory")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + regionCategory = new RegionCategory(property.Value.GetString()); + continue; + } + if (property.NameEquals("geographyGroup")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + geographyGroup = property.Value.GetString(); + continue; + } + if (property.NameEquals("longitude")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + longitude = property.Value.GetString(); + continue; + } + if (property.NameEquals("latitude")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + latitude = property.Value.GetString(); + continue; + } + if (property.NameEquals("physicalLocation")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + physicalLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("pairedRegion")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(Models.PairedRegion.DeserializePairedRegion(item)); + } + } + pairedRegion = array; + continue; + } + } + return new LocationMetadata(regionType, regionCategory, geographyGroup, longitude, latitude, physicalLocation, pairedRegion); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/LocationMetadata.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/LocationMetadata.cs new file mode 100644 index 000000000000..cfe101f79983 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/LocationMetadata.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Location metadata information. + public partial class LocationMetadata + { + /// Initializes a new instance of LocationMetadata. + internal LocationMetadata() + { + } + + /// Initializes a new instance of LocationMetadata. + /// The type of the region. + /// The category of the region. + /// The geography group of the location. + /// The longitude of the location. + /// The latitude of the location. + /// The physical location of the Azure location. + /// The regions paired to this region. + internal LocationMetadata(RegionType? regionType, RegionCategory? regionCategory, string geographyGroup, string longitude, string latitude, string physicalLocation, IReadOnlyList pairedRegion) + { + RegionType = regionType; + RegionCategory = regionCategory; + GeographyGroup = geographyGroup; + Longitude = longitude; + Latitude = latitude; + PhysicalLocation = physicalLocation; + PairedRegion = pairedRegion; + } + + /// The type of the region. + public RegionType? RegionType { get; } + /// The category of the region. + public RegionCategory? RegionCategory { get; } + /// The geography group of the location. + public string GeographyGroup { get; } + /// The longitude of the location. + public string Longitude { get; } + /// The latitude of the location. + public string Latitude { get; } + /// The physical location of the Azure location. + public string PhysicalLocation { get; } + /// The regions paired to this region. + public IReadOnlyList PairedRegion { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/LockLevel.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/LockLevel.cs new file mode 100644 index 000000000000..84f27a408068 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/LockLevel.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Management.Resources.Models +{ + /// The level of the lock. Possible values are: NotSpecified, CanNotDelete, ReadOnly. CanNotDelete means authorized users are able to read and modify the resources, but not delete. ReadOnly means authorized users can only read from a resource, but they can't modify or delete it. + public readonly partial struct LockLevel : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + public LockLevel(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotSpecifiedValue = "NotSpecified"; + private const string CanNotDeleteValue = "CanNotDelete"; + private const string ReadOnlyValue = "ReadOnly"; + + /// NotSpecified. + public static LockLevel NotSpecified { get; } = new LockLevel(NotSpecifiedValue); + /// CanNotDelete. + public static LockLevel CanNotDelete { get; } = new LockLevel(CanNotDeleteValue); + /// ReadOnly. + public static LockLevel ReadOnly { get; } = new LockLevel(ReadOnlyValue); + /// Determines if two values are the same. + public static bool operator ==(LockLevel left, LockLevel right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LockLevel left, LockLevel right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator LockLevel(string value) => new LockLevel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LockLevel other && Equals(other); + /// + public bool Equals(LockLevel 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/resources/Azure.Management.Resources/src/Generated/Models/ManagedByTenant.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagedByTenant.Serialization.cs new file mode 100644 index 000000000000..87741eb0bdf5 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagedByTenant.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ManagedByTenant + { + internal static ManagedByTenant DeserializeManagedByTenant(JsonElement element) + { + string tenantId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tenantId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tenantId = property.Value.GetString(); + continue; + } + } + return new ManagedByTenant(tenantId); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagedByTenant.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagedByTenant.cs new file mode 100644 index 000000000000..a312aa12f708 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagedByTenant.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Information about a tenant managing the subscription. + public partial class ManagedByTenant + { + /// Initializes a new instance of ManagedByTenant. + internal ManagedByTenant() + { + } + + /// Initializes a new instance of ManagedByTenant. + /// The tenant ID of the managing tenant. This is a GUID. + internal ManagedByTenant(string tenantId) + { + TenantId = tenantId; + } + + /// The tenant ID of the managing tenant. This is a GUID. + public string TenantId { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagedServiceIdentity.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagedServiceIdentity.Serialization.cs new file mode 100644 index 000000000000..45af1e260c0e --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagedServiceIdentity.Serialization.cs @@ -0,0 +1,78 @@ +// 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.Management.Resources.Models +{ + public partial class ManagedServiceIdentity : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + if (UserAssignedIdentities != null) + { + writer.WritePropertyName("userAssignedIdentities"); + writer.WriteStartObject(); + foreach (var item in UserAssignedIdentities) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static ManagedServiceIdentity DeserializeManagedServiceIdentity(JsonElement element) + { + string type = default; + IDictionary userAssignedIdentities = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("userAssignedIdentities")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, UserAssignedIdentity.DeserializeUserAssignedIdentity(property0.Value)); + } + } + userAssignedIdentities = dictionary; + continue; + } + } + return new ManagedServiceIdentity(type, userAssignedIdentities); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagedServiceIdentity.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagedServiceIdentity.cs new file mode 100644 index 000000000000..e9c4a0285130 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagedServiceIdentity.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Managed identity generic object. + public partial class ManagedServiceIdentity + { + /// Initializes a new instance of ManagedServiceIdentity. + public ManagedServiceIdentity() + { + Type = "UserAssigned"; + } + + /// Initializes a new instance of ManagedServiceIdentity. + /// Type of the managed identity. + /// The list of user-assigned managed identities associated with the resource. Key is the Azure resource Id of the managed identity. + internal ManagedServiceIdentity(string type, IDictionary userAssignedIdentities) + { + Type = type; + UserAssignedIdentities = userAssignedIdentities; + } + + /// Type of the managed identity. + public string Type { get; set; } + /// The list of user-assigned managed identities associated with the resource. Key is the Azure resource Id of the managed identity. + public IDictionary UserAssignedIdentities { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockListResult.Serialization.cs new file mode 100644 index 000000000000..3b28a72a307d --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class ManagementLockListResult + { + internal static ManagementLockListResult DeserializeManagementLockListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ManagementLockObject.DeserializeManagementLockObject(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new ManagementLockListResult(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockListResult.cs new file mode 100644 index 000000000000..2d9f2af04976 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// The list of locks. + public partial class ManagementLockListResult + { + /// Initializes a new instance of ManagementLockListResult. + internal ManagementLockListResult() + { + } + + /// Initializes a new instance of ManagementLockListResult. + /// The list of locks. + /// The URL to use for getting the next set of results. + internal ManagementLockListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The list of locks. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockObject.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockObject.Serialization.cs new file mode 100644 index 000000000000..5e036efe7598 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockObject.Serialization.cs @@ -0,0 +1,140 @@ +// 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.Management.Resources.Models +{ + public partial class ManagementLockObject : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WritePropertyName("level"); + writer.WriteStringValue(Level.ToString()); + if (Notes != null) + { + writer.WritePropertyName("notes"); + writer.WriteStringValue(Notes); + } + if (Owners != null) + { + writer.WritePropertyName("owners"); + writer.WriteStartArray(); + foreach (var item in Owners) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ManagementLockObject DeserializeManagementLockObject(JsonElement element) + { + string id = default; + string type = default; + string name = default; + LockLevel level = default; + string notes = default; + IList owners = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("level")) + { + level = new LockLevel(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("notes")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + notes = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("owners")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ManagementLockOwner.DeserializeManagementLockOwner(item)); + } + } + owners = array; + continue; + } + } + continue; + } + } + return new ManagementLockObject(id, type, name, level, notes, owners); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockObject.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockObject.cs new file mode 100644 index 000000000000..55bcd7dddda5 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockObject.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// The lock information. + public partial class ManagementLockObject + { + /// Initializes a new instance of ManagementLockObject. + /// The level of the lock. Possible values are: NotSpecified, CanNotDelete, ReadOnly. CanNotDelete means authorized users are able to read and modify the resources, but not delete. ReadOnly means authorized users can only read from a resource, but they can't modify or delete it. + public ManagementLockObject(LockLevel level) + { + Level = level; + } + + /// Initializes a new instance of ManagementLockObject. + /// The resource ID of the lock. + /// The resource type of the lock - Microsoft.Authorization/locks. + /// The name of the lock. + /// The level of the lock. Possible values are: NotSpecified, CanNotDelete, ReadOnly. CanNotDelete means authorized users are able to read and modify the resources, but not delete. ReadOnly means authorized users can only read from a resource, but they can't modify or delete it. + /// Notes about the lock. Maximum of 512 characters. + /// The owners of the lock. + internal ManagementLockObject(string id, string type, string name, LockLevel level, string notes, IList owners) + { + Id = id; + Type = type; + Name = name; + Level = level; + Notes = notes; + Owners = owners; + } + + /// The resource ID of the lock. + public string Id { get; } + /// The resource type of the lock - Microsoft.Authorization/locks. + public string Type { get; } + /// The name of the lock. + public string Name { get; } + /// The level of the lock. Possible values are: NotSpecified, CanNotDelete, ReadOnly. CanNotDelete means authorized users are able to read and modify the resources, but not delete. ReadOnly means authorized users can only read from a resource, but they can't modify or delete it. + public LockLevel Level { get; set; } + /// Notes about the lock. Maximum of 512 characters. + public string Notes { get; set; } + /// The owners of the lock. + public IList Owners { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockOwner.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockOwner.Serialization.cs new file mode 100644 index 000000000000..04bd8a7eecc1 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockOwner.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ManagementLockOwner : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (ApplicationId != null) + { + writer.WritePropertyName("applicationId"); + writer.WriteStringValue(ApplicationId); + } + writer.WriteEndObject(); + } + + internal static ManagementLockOwner DeserializeManagementLockOwner(JsonElement element) + { + string applicationId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("applicationId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationId = property.Value.GetString(); + continue; + } + } + return new ManagementLockOwner(applicationId); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockOwner.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockOwner.cs new file mode 100644 index 000000000000..d907fddac3a6 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ManagementLockOwner.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Lock owner properties. + public partial class ManagementLockOwner + { + /// Initializes a new instance of ManagementLockOwner. + public ManagementLockOwner() + { + } + + /// Initializes a new instance of ManagementLockOwner. + /// The application ID of the lock owner. + internal ManagementLockOwner(string applicationId) + { + ApplicationId = applicationId; + } + + /// The application ID of the lock owner. + public string ApplicationId { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeployment.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeployment.Serialization.cs new file mode 100644 index 000000000000..e2d9c7c2cc77 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeployment.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class OnErrorDeployment : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.Value.ToSerialString()); + } + if (DeploymentName != null) + { + writer.WritePropertyName("deploymentName"); + writer.WriteStringValue(DeploymentName); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeployment.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeployment.cs new file mode 100644 index 000000000000..3b2bda3e51ee --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeployment.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Deployment on error behavior. + public partial class OnErrorDeployment + { + /// Initializes a new instance of OnErrorDeployment. + public OnErrorDeployment() + { + } + + /// Initializes a new instance of OnErrorDeployment. + /// The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + /// The deployment to be used on error case. + internal OnErrorDeployment(OnErrorDeploymentType? type, string deploymentName) + { + Type = type; + DeploymentName = deploymentName; + } + + /// The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + public OnErrorDeploymentType? Type { get; set; } + /// The deployment to be used on error case. + public string DeploymentName { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeploymentExtended.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeploymentExtended.Serialization.cs new file mode 100644 index 000000000000..32056f005ced --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeploymentExtended.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.Management.Resources.Models +{ + public partial class OnErrorDeploymentExtended + { + internal static OnErrorDeploymentExtended DeserializeOnErrorDeploymentExtended(JsonElement element) + { + string provisioningState = default; + OnErrorDeploymentType? type = default; + string deploymentName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString().ToOnErrorDeploymentType(); + continue; + } + if (property.NameEquals("deploymentName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deploymentName = property.Value.GetString(); + continue; + } + } + return new OnErrorDeploymentExtended(provisioningState, type, deploymentName); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeploymentExtended.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeploymentExtended.cs new file mode 100644 index 000000000000..e67983c907e1 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeploymentExtended.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Deployment on error behavior with additional details. + public partial class OnErrorDeploymentExtended + { + /// Initializes a new instance of OnErrorDeploymentExtended. + internal OnErrorDeploymentExtended() + { + } + + /// Initializes a new instance of OnErrorDeploymentExtended. + /// The state of the provisioning for the on error deployment. + /// The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + /// The deployment to be used on error case. + internal OnErrorDeploymentExtended(string provisioningState, OnErrorDeploymentType? type, string deploymentName) + { + ProvisioningState = provisioningState; + Type = type; + DeploymentName = deploymentName; + } + + /// The state of the provisioning for the on error deployment. + public string ProvisioningState { get; } + /// The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + public OnErrorDeploymentType? Type { get; } + /// The deployment to be used on error case. + public string DeploymentName { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeploymentType.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeploymentType.Serialization.cs new file mode 100644 index 000000000000..673a14a77218 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeploymentType.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class OnErrorDeploymentTypeExtensions + { + public static string ToSerialString(this OnErrorDeploymentType value) => value switch + { + OnErrorDeploymentType.LastSuccessful => "LastSuccessful", + OnErrorDeploymentType.SpecificDeployment => "SpecificDeployment", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown OnErrorDeploymentType value.") + }; + + public static OnErrorDeploymentType ToOnErrorDeploymentType(this string value) + { + if (string.Equals(value, "LastSuccessful", StringComparison.InvariantCultureIgnoreCase)) return OnErrorDeploymentType.LastSuccessful; + if (string.Equals(value, "SpecificDeployment", StringComparison.InvariantCultureIgnoreCase)) return OnErrorDeploymentType.SpecificDeployment; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown OnErrorDeploymentType value."); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeploymentType.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeploymentType.cs new file mode 100644 index 000000000000..c052ec11cf2c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OnErrorDeploymentType.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + public enum OnErrorDeploymentType + { + /// LastSuccessful. + LastSuccessful, + /// SpecificDeployment. + SpecificDeployment + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Operation.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Operation.Serialization.cs new file mode 100644 index 000000000000..1129022af499 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Operation.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class Operation + { + internal static Operation DeserializeOperation(JsonElement element) + { + string name = default; + OperationDisplay display = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("display")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + display = OperationDisplay.DeserializeOperationDisplay(property.Value); + continue; + } + } + return new Operation(name, display); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Operation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..dc2c89c91491 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Operation.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Microsoft.Resources operation. + public partial class Operation + { + /// Initializes a new instance of Operation. + internal Operation() + { + } + + /// Initializes a new instance of Operation. + /// Operation name: {provider}/{resource}/{operation}. + /// The object that represents the operation. + internal Operation(string name, OperationDisplay display) + { + Name = name; + Display = display; + } + + /// Operation name: {provider}/{resource}/{operation}. + public string Name { get; } + /// The object that represents the operation. + public OperationDisplay Display { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated.Serialization.cs new file mode 100644 index 000000000000..dd4f37dd4556 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class OperationAutoGenerated + { + internal static OperationAutoGenerated DeserializeOperationAutoGenerated(JsonElement element) + { + string name = default; + OperationDisplayAutoGenerated display = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("display")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + display = OperationDisplayAutoGenerated.DeserializeOperationDisplayAutoGenerated(property.Value); + continue; + } + } + return new OperationAutoGenerated(name, display); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated.cs new file mode 100644 index 000000000000..d60c1f19497d --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Microsoft.Features operation. + public partial class OperationAutoGenerated + { + /// Initializes a new instance of OperationAutoGenerated. + internal OperationAutoGenerated() + { + } + + /// Initializes a new instance of OperationAutoGenerated. + /// Operation name: {provider}/{resource}/{operation}. + /// The object that represents the operation. + internal OperationAutoGenerated(string name, OperationDisplayAutoGenerated display) + { + Name = name; + Display = display; + } + + /// Operation name: {provider}/{resource}/{operation}. + public string Name { get; } + /// The object that represents the operation. + public OperationDisplayAutoGenerated Display { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated2.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated2.Serialization.cs new file mode 100644 index 000000000000..4f05f967e8ca --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated2.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class OperationAutoGenerated2 + { + internal static OperationAutoGenerated2 DeserializeOperationAutoGenerated2(JsonElement element) + { + string name = default; + OperationDisplayAutoGenerated2 display = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("display")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + display = OperationDisplayAutoGenerated2.DeserializeOperationDisplayAutoGenerated2(property.Value); + continue; + } + } + return new OperationAutoGenerated2(name, display); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated2.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated2.cs new file mode 100644 index 000000000000..0bb911aa4fe5 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated2.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Microsoft.Authorization operation. + public partial class OperationAutoGenerated2 + { + /// Initializes a new instance of OperationAutoGenerated2. + internal OperationAutoGenerated2() + { + } + + /// Initializes a new instance of OperationAutoGenerated2. + /// Operation name: {provider}/{resource}/{operation}. + /// The object that represents the operation. + internal OperationAutoGenerated2(string name, OperationDisplayAutoGenerated2 display) + { + Name = name; + Display = display; + } + + /// Operation name: {provider}/{resource}/{operation}. + public string Name { get; } + /// The object that represents the operation. + public OperationDisplayAutoGenerated2 Display { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated3.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated3.cs new file mode 100644 index 000000000000..7d0ffb8ef126 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationAutoGenerated3.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Microsoft.Resources operation. + internal partial class OperationAutoGenerated3 + { + /// Initializes a new instance of OperationAutoGenerated3. + internal OperationAutoGenerated3() + { + } + + /// Initializes a new instance of OperationAutoGenerated3. + /// Operation name: {provider}/{resource}/{operation}. + /// The object that represents the operation. + internal OperationAutoGenerated3(string name, OperationDisplayAutoGenerated3 display) + { + Name = name; + Display = display; + } + + /// Operation name: {provider}/{resource}/{operation}. + public string Name { get; set; } + /// The object that represents the operation. + public OperationDisplayAutoGenerated3 Display { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplay.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplay.Serialization.cs new file mode 100644 index 000000000000..49c8e51726bc --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplay.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class OperationDisplay + { + internal static OperationDisplay DeserializeOperationDisplay(JsonElement element) + { + string provider = default; + string resource = default; + string operation = default; + string description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provider")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provider = property.Value.GetString(); + continue; + } + if (property.NameEquals("resource")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resource = property.Value.GetString(); + continue; + } + if (property.NameEquals("operation")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + operation = property.Value.GetString(); + continue; + } + if (property.NameEquals("description")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + description = property.Value.GetString(); + continue; + } + } + return new OperationDisplay(provider, resource, operation, description); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplay.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..c08367d900ec --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The object that represents the operation. + public partial class OperationDisplay + { + /// Initializes a new instance of OperationDisplay. + internal OperationDisplay() + { + } + + /// Initializes a new instance of OperationDisplay. + /// Service provider: Microsoft.Resources. + /// Resource on which the operation is performed: Profile, endpoint, etc. + /// Operation type: Read, write, delete, etc. + /// Description of the operation. + internal OperationDisplay(string provider, string resource, string operation, string description) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + } + + /// Service provider: Microsoft.Resources. + public string Provider { get; } + /// Resource on which the operation is performed: Profile, endpoint, etc. + public string Resource { get; } + /// Operation type: Read, write, delete, etc. + public string Operation { get; } + /// Description of the operation. + public string Description { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated.Serialization.cs new file mode 100644 index 000000000000..e1b183117062 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated.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.Management.Resources.Models +{ + public partial class OperationDisplayAutoGenerated + { + internal static OperationDisplayAutoGenerated DeserializeOperationDisplayAutoGenerated(JsonElement element) + { + string provider = default; + string resource = default; + string operation = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provider")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provider = property.Value.GetString(); + continue; + } + if (property.NameEquals("resource")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resource = property.Value.GetString(); + continue; + } + if (property.NameEquals("operation")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + operation = property.Value.GetString(); + continue; + } + } + return new OperationDisplayAutoGenerated(provider, resource, operation); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated.cs new file mode 100644 index 000000000000..99718bb875c0 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The object that represents the operation. + public partial class OperationDisplayAutoGenerated + { + /// Initializes a new instance of OperationDisplayAutoGenerated. + internal OperationDisplayAutoGenerated() + { + } + + /// Initializes a new instance of OperationDisplayAutoGenerated. + /// Service provider: Microsoft.Features. + /// Resource on which the operation is performed: Profile, endpoint, etc. + /// Operation type: Read, write, delete, etc. + internal OperationDisplayAutoGenerated(string provider, string resource, string operation) + { + Provider = provider; + Resource = resource; + Operation = operation; + } + + /// Service provider: Microsoft.Features. + public string Provider { get; } + /// Resource on which the operation is performed: Profile, endpoint, etc. + public string Resource { get; } + /// Operation type: Read, write, delete, etc. + public string Operation { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated2.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated2.Serialization.cs new file mode 100644 index 000000000000..245e1584298f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated2.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.Management.Resources.Models +{ + public partial class OperationDisplayAutoGenerated2 + { + internal static OperationDisplayAutoGenerated2 DeserializeOperationDisplayAutoGenerated2(JsonElement element) + { + string provider = default; + string resource = default; + string operation = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provider")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provider = property.Value.GetString(); + continue; + } + if (property.NameEquals("resource")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resource = property.Value.GetString(); + continue; + } + if (property.NameEquals("operation")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + operation = property.Value.GetString(); + continue; + } + } + return new OperationDisplayAutoGenerated2(provider, resource, operation); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated2.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated2.cs new file mode 100644 index 000000000000..bad06fd66492 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated2.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The object that represents the operation. + public partial class OperationDisplayAutoGenerated2 + { + /// Initializes a new instance of OperationDisplayAutoGenerated2. + internal OperationDisplayAutoGenerated2() + { + } + + /// Initializes a new instance of OperationDisplayAutoGenerated2. + /// Service provider: Microsoft.Authorization. + /// Resource on which the operation is performed: Profile, endpoint, etc. + /// Operation type: Read, write, delete, etc. + internal OperationDisplayAutoGenerated2(string provider, string resource, string operation) + { + Provider = provider; + Resource = resource; + Operation = operation; + } + + /// Service provider: Microsoft.Authorization. + public string Provider { get; } + /// Resource on which the operation is performed: Profile, endpoint, etc. + public string Resource { get; } + /// Operation type: Read, write, delete, etc. + public string Operation { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated3.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated3.cs new file mode 100644 index 000000000000..2ffb0d1df825 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationDisplayAutoGenerated3.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The object that represents the operation. + internal partial class OperationDisplayAutoGenerated3 + { + /// Initializes a new instance of OperationDisplayAutoGenerated3. + internal OperationDisplayAutoGenerated3() + { + } + + /// Initializes a new instance of OperationDisplayAutoGenerated3. + /// Service provider: Microsoft.Resources. + /// Resource on which the operation is performed: Profile, endpoint, etc. + /// Operation type: Read, write, delete, etc. + /// Description of the operation. + internal OperationDisplayAutoGenerated3(string provider, string resource, string operation, string description) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + } + + /// Service provider: Microsoft.Resources. + public string Provider { get; set; } + /// Resource on which the operation is performed: Profile, endpoint, etc. + public string Resource { get; set; } + /// Operation type: Read, write, delete, etc. + public string Operation { get; set; } + /// Description of the operation. + public string Description { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResult.Serialization.cs new file mode 100644 index 000000000000..ecc34e6dae03 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class OperationListResult + { + internal static OperationListResult DeserializeOperationListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(Operation.DeserializeOperation(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new OperationListResult(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResult.cs new file mode 100644 index 000000000000..036ca0079444 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + public partial class OperationListResult + { + /// Initializes a new instance of OperationListResult. + internal OperationListResult() + { + } + + /// Initializes a new instance of OperationListResult. + /// List of Microsoft.Resources operations. + /// URL to get the next set of operation list results if there are any. + internal OperationListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// List of Microsoft.Resources operations. + public IReadOnlyList Value { get; } + /// URL to get the next set of operation list results if there are any. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated.Serialization.cs new file mode 100644 index 000000000000..c85c3de08f94 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class OperationListResultAutoGenerated + { + internal static OperationListResultAutoGenerated DeserializeOperationListResultAutoGenerated(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(OperationAutoGenerated.DeserializeOperationAutoGenerated(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new OperationListResultAutoGenerated(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated.cs new file mode 100644 index 000000000000..4469b30f842c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Result of the request to list Microsoft.Features operations. It contains a list of operations and a URL link to get the next set of results. + public partial class OperationListResultAutoGenerated + { + /// Initializes a new instance of OperationListResultAutoGenerated. + internal OperationListResultAutoGenerated() + { + } + + /// Initializes a new instance of OperationListResultAutoGenerated. + /// List of Microsoft.Features operations. + /// URL to get the next set of operation list results if there are any. + internal OperationListResultAutoGenerated(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// List of Microsoft.Features operations. + public IReadOnlyList Value { get; } + /// URL to get the next set of operation list results if there are any. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated2.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated2.Serialization.cs new file mode 100644 index 000000000000..f15a4b248ec4 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated2.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class OperationListResultAutoGenerated2 + { + internal static OperationListResultAutoGenerated2 DeserializeOperationListResultAutoGenerated2(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(OperationAutoGenerated2.DeserializeOperationAutoGenerated2(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new OperationListResultAutoGenerated2(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated2.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated2.cs new file mode 100644 index 000000000000..8b65d0a238fa --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated2.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Result of the request to list Microsoft.Authorization operations. It contains a list of operations and a URL link to get the next set of results. + public partial class OperationListResultAutoGenerated2 + { + /// Initializes a new instance of OperationListResultAutoGenerated2. + internal OperationListResultAutoGenerated2() + { + } + + /// Initializes a new instance of OperationListResultAutoGenerated2. + /// List of Microsoft.Authorization operations. + /// URL to get the next set of operation list results if there are any. + internal OperationListResultAutoGenerated2(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// List of Microsoft.Authorization operations. + public IReadOnlyList Value { get; } + /// URL to get the next set of operation list results if there are any. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated3.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated3.cs new file mode 100644 index 000000000000..d0ba0160821f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/OperationListResultAutoGenerated3.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + internal partial class OperationListResultAutoGenerated3 + { + /// Initializes a new instance of OperationListResultAutoGenerated3. + internal OperationListResultAutoGenerated3() + { + } + + /// Initializes a new instance of OperationListResultAutoGenerated3. + /// List of Microsoft.Resources operations. + /// URL to get the next set of operation list results if there are any. + internal OperationListResultAutoGenerated3(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// List of Microsoft.Resources operations. + public IReadOnlyList Value { get; set; } + /// URL to get the next set of operation list results if there are any. + public string NextLink { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PairedRegion.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PairedRegion.Serialization.cs new file mode 100644 index 000000000000..53ba313c4da2 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PairedRegion.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.Management.Resources.Models +{ + public partial class PairedRegion + { + internal static PairedRegion DeserializePairedRegion(JsonElement element) + { + string name = default; + string id = default; + string subscriptionId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscriptionId = property.Value.GetString(); + continue; + } + } + return new PairedRegion(name, id, subscriptionId); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PairedRegion.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PairedRegion.cs new file mode 100644 index 000000000000..ab2381250282 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PairedRegion.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Information regarding paired region. + public partial class PairedRegion + { + /// Initializes a new instance of PairedRegion. + internal PairedRegion() + { + } + + /// Initializes a new instance of PairedRegion. + /// The name of the paired region. + /// The fully qualified ID of the location. For example, /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. + /// The subscription ID. + internal PairedRegion(string name, string id, string subscriptionId) + { + Name = name; + Id = id; + SubscriptionId = subscriptionId; + } + + /// The name of the paired region. + public string Name { get; } + /// The fully qualified ID of the location. For example, /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. + public string Id { get; } + /// The subscription ID. + public string SubscriptionId { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterDefinitionsValue.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterDefinitionsValue.Serialization.cs new file mode 100644 index 000000000000..58b9f4c0e379 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterDefinitionsValue.Serialization.cs @@ -0,0 +1,107 @@ +// 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.Management.Resources.Models +{ + public partial class ParameterDefinitionsValue : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.Value.ToString()); + } + if (AllowedValues != null) + { + writer.WritePropertyName("allowedValues"); + writer.WriteStartArray(); + foreach (var item in AllowedValues) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (DefaultValue != null) + { + writer.WritePropertyName("defaultValue"); + writer.WriteObjectValue(DefaultValue); + } + if (Metadata != null) + { + writer.WritePropertyName("metadata"); + writer.WriteObjectValue(Metadata); + } + writer.WriteEndObject(); + } + + internal static ParameterDefinitionsValue DeserializeParameterDefinitionsValue(JsonElement element) + { + ParameterType? type = default; + IList allowedValues = default; + object defaultValue = default; + ParameterDefinitionsValueMetadata metadata = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ParameterType(property.Value.GetString()); + continue; + } + if (property.NameEquals("allowedValues")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetObject()); + } + } + allowedValues = array; + continue; + } + if (property.NameEquals("defaultValue")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultValue = property.Value.GetObject(); + continue; + } + if (property.NameEquals("metadata")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metadata = ParameterDefinitionsValueMetadata.DeserializeParameterDefinitionsValueMetadata(property.Value); + continue; + } + } + return new ParameterDefinitionsValue(type, allowedValues, defaultValue, metadata); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterDefinitionsValue.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterDefinitionsValue.cs new file mode 100644 index 000000000000..24b2445bbbdc --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterDefinitionsValue.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// The definition of a parameter that can be provided to the policy. + public partial class ParameterDefinitionsValue + { + /// Initializes a new instance of ParameterDefinitionsValue. + public ParameterDefinitionsValue() + { + } + + /// Initializes a new instance of ParameterDefinitionsValue. + /// The data type of the parameter. + /// The allowed values for the parameter. + /// The default value for the parameter if no value is provided. + /// General metadata for the parameter. + internal ParameterDefinitionsValue(ParameterType? type, IList allowedValues, object defaultValue, ParameterDefinitionsValueMetadata metadata) + { + Type = type; + AllowedValues = allowedValues; + DefaultValue = defaultValue; + Metadata = metadata; + } + + /// The data type of the parameter. + public ParameterType? Type { get; set; } + /// The allowed values for the parameter. + public IList AllowedValues { get; set; } + /// The default value for the parameter if no value is provided. + public object DefaultValue { get; set; } + /// General metadata for the parameter. + public ParameterDefinitionsValueMetadata Metadata { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterDefinitionsValueMetadata.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterDefinitionsValueMetadata.Serialization.cs new file mode 100644 index 000000000000..730c48eb1db5 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterDefinitionsValueMetadata.Serialization.cs @@ -0,0 +1,77 @@ +// 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.Management.Resources.Models +{ + public partial class ParameterDefinitionsValueMetadata : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (DisplayName != null) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Description != null) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(Description); + } + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + + internal static ParameterDefinitionsValueMetadata DeserializeParameterDefinitionsValueMetadata(JsonElement element) + { + string displayName = default; + string description = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + description = property.Value.GetString(); + continue; + } + additionalPropertiesDictionary ??= new Dictionary(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + additionalPropertiesDictionary.Add(property.Name, null); + } + else + { + additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); + } + } + additionalProperties = additionalPropertiesDictionary; + return new ParameterDefinitionsValueMetadata(displayName, description, additionalProperties); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterDefinitionsValueMetadata.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterDefinitionsValueMetadata.cs new file mode 100644 index 000000000000..6a99fb63c231 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterDefinitionsValueMetadata.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// General metadata for the parameter. + public partial class ParameterDefinitionsValueMetadata : IDictionary + { + /// Initializes a new instance of ParameterDefinitionsValueMetadata. + public ParameterDefinitionsValueMetadata() + { + AdditionalProperties = new Dictionary(); + } + + /// Initializes a new instance of ParameterDefinitionsValueMetadata. + /// The display name for the parameter. + /// The description of the parameter. + /// . + internal ParameterDefinitionsValueMetadata(string displayName, string description, IDictionary additionalProperties) + { + DisplayName = displayName; + Description = description; + AdditionalProperties = additionalProperties ?? new Dictionary(); + } + + /// The display name for the parameter. + public string DisplayName { get; set; } + /// The description of the parameter. + public string Description { get; set; } + internal IDictionary AdditionalProperties { get; } + /// + public IEnumerator> GetEnumerator() => AdditionalProperties.GetEnumerator(); + /// + IEnumerator IEnumerable.GetEnumerator() => AdditionalProperties.GetEnumerator(); + /// + public bool TryGetValue(string key, out object value) => AdditionalProperties.TryGetValue(key, out value); + /// + public bool ContainsKey(string key) => AdditionalProperties.ContainsKey(key); + /// + public ICollection Keys => AdditionalProperties.Keys; + /// + public ICollection Values => AdditionalProperties.Values; + /// + int ICollection>.Count => AdditionalProperties.Count; + /// + public void Add(string key, object value) => AdditionalProperties.Add(key, value); + /// + public bool Remove(string key) => AdditionalProperties.Remove(key); + /// + bool ICollection>.IsReadOnly => AdditionalProperties.IsReadOnly; + /// + void ICollection>.Add(KeyValuePair value) => AdditionalProperties.Add(value); + /// + bool ICollection>.Remove(KeyValuePair value) => AdditionalProperties.Remove(value); + /// + bool ICollection>.Contains(KeyValuePair value) => AdditionalProperties.Contains(value); + /// + void ICollection>.CopyTo(KeyValuePair[] destination, int offset) => AdditionalProperties.CopyTo(destination, offset); + /// + void ICollection>.Clear() => AdditionalProperties.Clear(); + /// + public object this[string key] + { + get => AdditionalProperties[key]; + set => AdditionalProperties[key] = value; + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterType.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterType.cs new file mode 100644 index 000000000000..907b10099dfc --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterType.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Management.Resources.Models +{ + /// The data type of the parameter. + public readonly partial struct ParameterType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + public ParameterType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StringValue = "String"; + private const string ArrayValue = "Array"; + private const string ObjectValue = "Object"; + private const string BooleanValue = "Boolean"; + private const string IntegerValue = "Integer"; + private const string FloatValue = "Float"; + private const string DateTimeValue = "DateTime"; + + /// String. + public static ParameterType String { get; } = new ParameterType(StringValue); + /// Array. + public static ParameterType Array { get; } = new ParameterType(ArrayValue); + /// Object. + public static ParameterType Object { get; } = new ParameterType(ObjectValue); + /// Boolean. + public static ParameterType Boolean { get; } = new ParameterType(BooleanValue); + /// Integer. + public static ParameterType Integer { get; } = new ParameterType(IntegerValue); + /// Float. + public static ParameterType Float { get; } = new ParameterType(FloatValue); + /// DateTime. + public static ParameterType DateTime { get; } = new ParameterType(DateTimeValue); + /// Determines if two values are the same. + public static bool operator ==(ParameterType left, ParameterType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ParameterType left, ParameterType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ParameterType(string value) => new ParameterType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ParameterType other && Equals(other); + /// + public bool Equals(ParameterType 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/resources/Azure.Management.Resources/src/Generated/Models/ParameterValuesValue.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterValuesValue.Serialization.cs new file mode 100644 index 000000000000..22df133927bd --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterValuesValue.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ParameterValuesValue : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Value != null) + { + writer.WritePropertyName("value"); + writer.WriteObjectValue(Value); + } + writer.WriteEndObject(); + } + + internal static ParameterValuesValue DeserializeParameterValuesValue(JsonElement element) + { + object value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetObject(); + continue; + } + } + return new ParameterValuesValue(value); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterValuesValue.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterValuesValue.cs new file mode 100644 index 000000000000..fca80147244f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParameterValuesValue.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The value of a parameter. + public partial class ParameterValuesValue + { + /// Initializes a new instance of ParameterValuesValue. + public ParameterValuesValue() + { + } + + /// Initializes a new instance of ParameterValuesValue. + /// The value of the parameter. + internal ParameterValuesValue(object value) + { + Value = value; + } + + /// The value of the parameter. + public object Value { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ParametersLink.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParametersLink.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ParametersLink.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ParametersLink.Serialization.cs index 9a5811e7a6c4..b392137ef904 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ParametersLink.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParametersLink.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ParametersLink : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ParametersLink.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParametersLink.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ParametersLink.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ParametersLink.cs index e6f7ee97ab91..4fe84c1daced 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ParametersLink.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ParametersLink.cs @@ -7,7 +7,7 @@ using System; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Entity representing the reference to the deployment parameters. public partial class ParametersLink diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Plan.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Plan.Serialization.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Plan.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/Plan.Serialization.cs index 13d9c3115aff..7f06910a94b9 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Plan.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Plan.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class Plan : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Plan.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Plan.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Plan.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/Plan.cs index 82fa421a6820..08a32248ffc6 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Plan.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Plan.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Plan for the resource. public partial class Plan diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PlanAutoGenerated.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PlanAutoGenerated.Serialization.cs new file mode 100644 index 000000000000..c38b3489aa27 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PlanAutoGenerated.Serialization.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class PlanAutoGenerated : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + writer.WritePropertyName("publisher"); + writer.WriteStringValue(Publisher); + writer.WritePropertyName("product"); + writer.WriteStringValue(Product); + if (PromotionCode != null) + { + writer.WritePropertyName("promotionCode"); + writer.WriteStringValue(PromotionCode); + } + writer.WritePropertyName("version"); + writer.WriteStringValue(Version); + writer.WriteEndObject(); + } + + internal static PlanAutoGenerated DeserializePlanAutoGenerated(JsonElement element) + { + string name = default; + string publisher = default; + string product = default; + string promotionCode = default; + string version = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisher")) + { + publisher = property.Value.GetString(); + continue; + } + if (property.NameEquals("product")) + { + product = property.Value.GetString(); + continue; + } + if (property.NameEquals("promotionCode")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + promotionCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("version")) + { + version = property.Value.GetString(); + continue; + } + } + return new PlanAutoGenerated(name, publisher, product, promotionCode, version); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PlanAutoGenerated.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PlanAutoGenerated.cs new file mode 100644 index 000000000000..369fbe11af1d --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PlanAutoGenerated.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// Plan for the managed application. + public partial class PlanAutoGenerated + { + /// Initializes a new instance of PlanAutoGenerated. + /// The plan name. + /// The publisher ID. + /// The product code. + /// The plan's version. + public PlanAutoGenerated(string name, string publisher, string product, string version) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + if (publisher == null) + { + throw new ArgumentNullException(nameof(publisher)); + } + if (product == null) + { + throw new ArgumentNullException(nameof(product)); + } + if (version == null) + { + throw new ArgumentNullException(nameof(version)); + } + + Name = name; + Publisher = publisher; + Product = product; + Version = version; + } + + /// Initializes a new instance of PlanAutoGenerated. + /// The plan name. + /// The publisher ID. + /// The product code. + /// The promotion code. + /// The plan's version. + internal PlanAutoGenerated(string name, string publisher, string product, string promotionCode, string version) + { + Name = name; + Publisher = publisher; + Product = product; + PromotionCode = promotionCode; + Version = version; + } + + /// The plan name. + public string Name { get; set; } + /// The publisher ID. + public string Publisher { get; set; } + /// The product code. + public string Product { get; set; } + /// The promotion code. + public string PromotionCode { get; set; } + /// The plan's version. + public string Version { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PlanPatchable.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PlanPatchable.Serialization.cs new file mode 100644 index 000000000000..8d1f3b790c75 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PlanPatchable.Serialization.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class PlanPatchable : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Publisher != null) + { + writer.WritePropertyName("publisher"); + writer.WriteStringValue(Publisher); + } + if (Product != null) + { + writer.WritePropertyName("product"); + writer.WriteStringValue(Product); + } + if (PromotionCode != null) + { + writer.WritePropertyName("promotionCode"); + writer.WriteStringValue(PromotionCode); + } + if (Version != null) + { + writer.WritePropertyName("version"); + writer.WriteStringValue(Version); + } + writer.WriteEndObject(); + } + + internal static PlanPatchable DeserializePlanPatchable(JsonElement element) + { + string name = default; + string publisher = default; + string product = default; + string promotionCode = default; + string version = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisher")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisher = property.Value.GetString(); + continue; + } + if (property.NameEquals("product")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + product = property.Value.GetString(); + continue; + } + if (property.NameEquals("promotionCode")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + promotionCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("version")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + version = property.Value.GetString(); + continue; + } + } + return new PlanPatchable(name, publisher, product, promotionCode, version); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PlanPatchable.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PlanPatchable.cs new file mode 100644 index 000000000000..d7ede641de8a --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PlanPatchable.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Plan for the managed application. + public partial class PlanPatchable + { + /// Initializes a new instance of PlanPatchable. + public PlanPatchable() + { + } + + /// Initializes a new instance of PlanPatchable. + /// The plan name. + /// The publisher ID. + /// The product code. + /// The promotion code. + /// The plan's version. + internal PlanPatchable(string name, string publisher, string product, string promotionCode, string version) + { + Name = name; + Publisher = publisher; + Product = product; + PromotionCode = promotionCode; + Version = version; + } + + /// The plan name. + public string Name { get; set; } + /// The publisher ID. + public string Publisher { get; set; } + /// The product code. + public string Product { get; set; } + /// The promotion code. + public string PromotionCode { get; set; } + /// The plan's version. + public string Version { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyAssignment.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyAssignment.Serialization.cs new file mode 100644 index 000000000000..b9edec2bab2e --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyAssignment.Serialization.cs @@ -0,0 +1,285 @@ +// 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.Management.Resources.Models +{ + public partial class PolicyAssignment : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Sku != null) + { + writer.WritePropertyName("sku"); + writer.WriteObjectValue(Sku); + } + if (Location != null) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Identity != null) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (DisplayName != null) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (PolicyDefinitionId != null) + { + writer.WritePropertyName("policyDefinitionId"); + writer.WriteStringValue(PolicyDefinitionId); + } + if (Scope != null) + { + writer.WritePropertyName("scope"); + writer.WriteStringValue(Scope); + } + if (NotScopes != null) + { + writer.WritePropertyName("notScopes"); + writer.WriteStartArray(); + foreach (var item in NotScopes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Parameters != null) + { + writer.WritePropertyName("parameters"); + writer.WriteStartObject(); + foreach (var item in Parameters) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Description != null) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(Description); + } + if (Metadata != null) + { + writer.WritePropertyName("metadata"); + writer.WriteObjectValue(Metadata); + } + if (EnforcementMode != null) + { + writer.WritePropertyName("enforcementMode"); + writer.WriteStringValue(EnforcementMode.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PolicyAssignment DeserializePolicyAssignment(JsonElement element) + { + string id = default; + string type = default; + string name = default; + PolicySku sku = default; + string location = default; + IdentityAutoGenerated identity = default; + string displayName = default; + string policyDefinitionId = default; + string scope = default; + IList notScopes = default; + IDictionary parameters = default; + string description = default; + object metadata = default; + EnforcementMode? enforcementMode = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("sku")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = PolicySku.DeserializePolicySku(property.Value); + continue; + } + if (property.NameEquals("location")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = IdentityAutoGenerated.DeserializeIdentityAutoGenerated(property.Value); + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("policyDefinitionId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policyDefinitionId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("scope")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scope = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("notScopes")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + notScopes = array; + continue; + } + if (property0.NameEquals("parameters")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + if (property1.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property1.Name, null); + } + else + { + dictionary.Add(property1.Name, ParameterValuesValue.DeserializeParameterValuesValue(property1.Value)); + } + } + parameters = dictionary; + continue; + } + if (property0.NameEquals("description")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("metadata")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metadata = property0.Value.GetObject(); + continue; + } + if (property0.NameEquals("enforcementMode")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enforcementMode = new EnforcementMode(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new PolicyAssignment(id, type, name, sku, location, identity, displayName, policyDefinitionId, scope, notScopes, parameters, description, metadata, enforcementMode); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyAssignment.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyAssignment.cs new file mode 100644 index 000000000000..4a4e35ea878c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyAssignment.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// The policy assignment. + public partial class PolicyAssignment + { + /// Initializes a new instance of PolicyAssignment. + public PolicyAssignment() + { + } + + /// Initializes a new instance of PolicyAssignment. + /// The ID of the policy assignment. + /// The type of the policy assignment. + /// The name of the policy assignment. + /// The policy sku. This property is optional, obsolete, and will be ignored. + /// The location of the policy assignment. Only required when utilizing managed identity. + /// The managed identity associated with the policy assignment. + /// The display name of the policy assignment. + /// The ID of the policy definition or policy set definition being assigned. + /// The scope for the policy assignment. + /// The policy's excluded scopes. + /// The parameter values for the assigned policy rule. The keys are the parameter names. + /// This message will be part of response in case of policy violation. + /// The policy assignment metadata. Metadata is an open ended object and is typically a collection of key value pairs. + /// The policy assignment enforcement mode. Possible values are Default and DoNotEnforce. + internal PolicyAssignment(string id, string type, string name, PolicySku sku, string location, IdentityAutoGenerated identity, string displayName, string policyDefinitionId, string scope, IList notScopes, IDictionary parameters, string description, object metadata, EnforcementMode? enforcementMode) + { + Id = id; + Type = type; + Name = name; + Sku = sku; + Location = location; + Identity = identity; + DisplayName = displayName; + PolicyDefinitionId = policyDefinitionId; + Scope = scope; + NotScopes = notScopes; + Parameters = parameters; + Description = description; + Metadata = metadata; + EnforcementMode = enforcementMode; + } + + /// The ID of the policy assignment. + public string Id { get; } + /// The type of the policy assignment. + public string Type { get; } + /// The name of the policy assignment. + public string Name { get; } + /// The policy sku. This property is optional, obsolete, and will be ignored. + public PolicySku Sku { get; set; } + /// The location of the policy assignment. Only required when utilizing managed identity. + public string Location { get; set; } + /// The managed identity associated with the policy assignment. + public IdentityAutoGenerated Identity { get; set; } + /// The display name of the policy assignment. + public string DisplayName { get; set; } + /// The ID of the policy definition or policy set definition being assigned. + public string PolicyDefinitionId { get; set; } + /// The scope for the policy assignment. + public string Scope { get; set; } + /// The policy's excluded scopes. + public IList NotScopes { get; set; } + /// The parameter values for the assigned policy rule. The keys are the parameter names. + public IDictionary Parameters { get; set; } + /// This message will be part of response in case of policy violation. + public string Description { get; set; } + /// The policy assignment metadata. Metadata is an open ended object and is typically a collection of key value pairs. + public object Metadata { get; set; } + /// The policy assignment enforcement mode. Possible values are Default and DoNotEnforce. + public EnforcementMode? EnforcementMode { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyAssignmentListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyAssignmentListResult.Serialization.cs new file mode 100644 index 000000000000..12c0b8343501 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyAssignmentListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class PolicyAssignmentListResult + { + internal static PolicyAssignmentListResult DeserializePolicyAssignmentListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(PolicyAssignment.DeserializePolicyAssignment(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new PolicyAssignmentListResult(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyAssignmentListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyAssignmentListResult.cs new file mode 100644 index 000000000000..11b8ffaf35b8 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyAssignmentListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// List of policy assignments. + public partial class PolicyAssignmentListResult + { + /// Initializes a new instance of PolicyAssignmentListResult. + internal PolicyAssignmentListResult() + { + } + + /// Initializes a new instance of PolicyAssignmentListResult. + /// An array of policy assignments. + /// The URL to use for getting the next set of results. + internal PolicyAssignmentListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of policy assignments. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinition.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinition.Serialization.cs new file mode 100644 index 000000000000..0e19d7454019 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinition.Serialization.cs @@ -0,0 +1,208 @@ +// 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.Management.Resources.Models +{ + public partial class PolicyDefinition : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (PolicyType != null) + { + writer.WritePropertyName("policyType"); + writer.WriteStringValue(PolicyType.Value.ToString()); + } + if (Mode != null) + { + writer.WritePropertyName("mode"); + writer.WriteStringValue(Mode); + } + if (DisplayName != null) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Description != null) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(Description); + } + if (PolicyRule != null) + { + writer.WritePropertyName("policyRule"); + writer.WriteObjectValue(PolicyRule); + } + if (Metadata != null) + { + writer.WritePropertyName("metadata"); + writer.WriteObjectValue(Metadata); + } + if (Parameters != null) + { + writer.WritePropertyName("parameters"); + writer.WriteStartObject(); + foreach (var item in Parameters) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PolicyDefinition DeserializePolicyDefinition(JsonElement element) + { + string id = default; + string name = default; + string type = default; + PolicyType? policyType = default; + string mode = default; + string displayName = default; + string description = default; + object policyRule = default; + object metadata = default; + IDictionary parameters = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("policyType")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policyType = new PolicyType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("mode")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("displayName")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("policyRule")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policyRule = property0.Value.GetObject(); + continue; + } + if (property0.NameEquals("metadata")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metadata = property0.Value.GetObject(); + continue; + } + if (property0.NameEquals("parameters")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + if (property1.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property1.Name, null); + } + else + { + dictionary.Add(property1.Name, ParameterDefinitionsValue.DeserializeParameterDefinitionsValue(property1.Value)); + } + } + parameters = dictionary; + continue; + } + } + continue; + } + } + return new PolicyDefinition(id, name, type, policyType, mode, displayName, description, policyRule, metadata, parameters); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinition.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinition.cs new file mode 100644 index 000000000000..db4df737b3cc --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinition.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// The policy definition. + public partial class PolicyDefinition + { + /// Initializes a new instance of PolicyDefinition. + public PolicyDefinition() + { + } + + /// Initializes a new instance of PolicyDefinition. + /// The ID of the policy definition. + /// The name of the policy definition. + /// The type of the resource (Microsoft.Authorization/policyDefinitions). + /// The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. + /// The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data. + /// The display name of the policy definition. + /// The policy definition description. + /// The policy rule. + /// The policy definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. + /// The parameter definitions for parameters used in the policy rule. The keys are the parameter names. + internal PolicyDefinition(string id, string name, string type, PolicyType? policyType, string mode, string displayName, string description, object policyRule, object metadata, IDictionary parameters) + { + Id = id; + Name = name; + Type = type; + PolicyType = policyType; + Mode = mode; + DisplayName = displayName; + Description = description; + PolicyRule = policyRule; + Metadata = metadata; + Parameters = parameters; + } + + /// The ID of the policy definition. + public string Id { get; } + /// The name of the policy definition. + public string Name { get; } + /// The type of the resource (Microsoft.Authorization/policyDefinitions). + public string Type { get; } + /// The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. + public PolicyType? PolicyType { get; set; } + /// The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data. + public string Mode { get; set; } + /// The display name of the policy definition. + public string DisplayName { get; set; } + /// The policy definition description. + public string Description { get; set; } + /// The policy rule. + public object PolicyRule { get; set; } + /// The policy definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. + public object Metadata { get; set; } + /// The parameter definitions for parameters used in the policy rule. The keys are the parameter names. + public IDictionary Parameters { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionGroup.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionGroup.Serialization.cs new file mode 100644 index 000000000000..4163088652ff --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionGroup.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class PolicyDefinitionGroup : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + if (DisplayName != null) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Category != null) + { + writer.WritePropertyName("category"); + writer.WriteStringValue(Category); + } + if (Description != null) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(Description); + } + if (AdditionalMetadataId != null) + { + writer.WritePropertyName("additionalMetadataId"); + writer.WriteStringValue(AdditionalMetadataId); + } + writer.WriteEndObject(); + } + + internal static PolicyDefinitionGroup DeserializePolicyDefinitionGroup(JsonElement element) + { + string name = default; + string displayName = default; + string category = default; + string description = default; + string additionalMetadataId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("category")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("description")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("additionalMetadataId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + additionalMetadataId = property.Value.GetString(); + continue; + } + } + return new PolicyDefinitionGroup(name, displayName, category, description, additionalMetadataId); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionGroup.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionGroup.cs new file mode 100644 index 000000000000..8aef0f100305 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionGroup.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// The policy definition group. + public partial class PolicyDefinitionGroup + { + /// Initializes a new instance of PolicyDefinitionGroup. + /// The name of the group. + public PolicyDefinitionGroup(string name) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + Name = name; + } + + /// Initializes a new instance of PolicyDefinitionGroup. + /// The name of the group. + /// The group's display name. + /// The group's category. + /// The group's description. + /// A resource ID of a resource that contains additional metadata about the group. + internal PolicyDefinitionGroup(string name, string displayName, string category, string description, string additionalMetadataId) + { + Name = name; + DisplayName = displayName; + Category = category; + Description = description; + AdditionalMetadataId = additionalMetadataId; + } + + /// The name of the group. + public string Name { get; set; } + /// The group's display name. + public string DisplayName { get; set; } + /// The group's category. + public string Category { get; set; } + /// The group's description. + public string Description { get; set; } + /// A resource ID of a resource that contains additional metadata about the group. + public string AdditionalMetadataId { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionListResult.Serialization.cs new file mode 100644 index 000000000000..d8bb44c172df --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class PolicyDefinitionListResult + { + internal static PolicyDefinitionListResult DeserializePolicyDefinitionListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(PolicyDefinition.DeserializePolicyDefinition(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new PolicyDefinitionListResult(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionListResult.cs new file mode 100644 index 000000000000..0d41fbe0a702 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// List of policy definitions. + public partial class PolicyDefinitionListResult + { + /// Initializes a new instance of PolicyDefinitionListResult. + internal PolicyDefinitionListResult() + { + } + + /// Initializes a new instance of PolicyDefinitionListResult. + /// An array of policy definitions. + /// The URL to use for getting the next set of results. + internal PolicyDefinitionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of policy definitions. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionReference.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionReference.Serialization.cs new file mode 100644 index 000000000000..92c4fa9beb12 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionReference.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.Management.Resources.Models +{ + public partial class PolicyDefinitionReference : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("policyDefinitionId"); + writer.WriteStringValue(PolicyDefinitionId); + if (Parameters != null) + { + writer.WritePropertyName("parameters"); + writer.WriteStartObject(); + foreach (var item in Parameters) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (PolicyDefinitionReferenceId != null) + { + writer.WritePropertyName("policyDefinitionReferenceId"); + writer.WriteStringValue(PolicyDefinitionReferenceId); + } + if (GroupNames != null) + { + writer.WritePropertyName("groupNames"); + writer.WriteStartArray(); + foreach (var item in GroupNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static PolicyDefinitionReference DeserializePolicyDefinitionReference(JsonElement element) + { + string policyDefinitionId = default; + IDictionary parameters = default; + string policyDefinitionReferenceId = default; + IList groupNames = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyDefinitionId")) + { + policyDefinitionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("parameters")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, ParameterValuesValue.DeserializeParameterValuesValue(property0.Value)); + } + } + parameters = dictionary; + continue; + } + if (property.NameEquals("policyDefinitionReferenceId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policyDefinitionReferenceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("groupNames")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + groupNames = array; + continue; + } + } + return new PolicyDefinitionReference(policyDefinitionId, parameters, policyDefinitionReferenceId, groupNames); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionReference.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionReference.cs new file mode 100644 index 000000000000..7181707475c3 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyDefinitionReference.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// The policy definition reference. + public partial class PolicyDefinitionReference + { + /// Initializes a new instance of PolicyDefinitionReference. + /// The ID of the policy definition or policy set definition. + public PolicyDefinitionReference(string policyDefinitionId) + { + if (policyDefinitionId == null) + { + throw new ArgumentNullException(nameof(policyDefinitionId)); + } + + PolicyDefinitionId = policyDefinitionId; + } + + /// Initializes a new instance of PolicyDefinitionReference. + /// The ID of the policy definition or policy set definition. + /// The parameter values for the referenced policy rule. The keys are the parameter names. + /// A unique id (within the policy set definition) for this policy definition reference. + /// The name of the groups that this policy definition reference belongs to. + internal PolicyDefinitionReference(string policyDefinitionId, IDictionary parameters, string policyDefinitionReferenceId, IList groupNames) + { + PolicyDefinitionId = policyDefinitionId; + Parameters = parameters; + PolicyDefinitionReferenceId = policyDefinitionReferenceId; + GroupNames = groupNames; + } + + /// The ID of the policy definition or policy set definition. + public string PolicyDefinitionId { get; set; } + /// The parameter values for the referenced policy rule. The keys are the parameter names. + public IDictionary Parameters { get; set; } + /// A unique id (within the policy set definition) for this policy definition reference. + public string PolicyDefinitionReferenceId { get; set; } + /// The name of the groups that this policy definition reference belongs to. + public IList GroupNames { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySetDefinition.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySetDefinition.Serialization.cs new file mode 100644 index 000000000000..50c59a9cc316 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySetDefinition.Serialization.cs @@ -0,0 +1,242 @@ +// 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.Management.Resources.Models +{ + public partial class PolicySetDefinition : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (PolicyType != null) + { + writer.WritePropertyName("policyType"); + writer.WriteStringValue(PolicyType.Value.ToString()); + } + if (DisplayName != null) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Description != null) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(Description); + } + if (Metadata != null) + { + writer.WritePropertyName("metadata"); + writer.WriteObjectValue(Metadata); + } + if (Parameters != null) + { + writer.WritePropertyName("parameters"); + writer.WriteStartObject(); + foreach (var item in Parameters) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (PolicyDefinitions != null) + { + writer.WritePropertyName("policyDefinitions"); + writer.WriteStartArray(); + foreach (var item in PolicyDefinitions) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (PolicyDefinitionGroups != null) + { + writer.WritePropertyName("policyDefinitionGroups"); + writer.WriteStartArray(); + foreach (var item in PolicyDefinitionGroups) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PolicySetDefinition DeserializePolicySetDefinition(JsonElement element) + { + string id = default; + string name = default; + string type = default; + PolicyType? policyType = default; + string displayName = default; + string description = default; + object metadata = default; + IDictionary parameters = default; + IList policyDefinitions = default; + IList policyDefinitionGroups = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("policyType")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policyType = new PolicyType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("displayName")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("metadata")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metadata = property0.Value.GetObject(); + continue; + } + if (property0.NameEquals("parameters")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + if (property1.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property1.Name, null); + } + else + { + dictionary.Add(property1.Name, ParameterDefinitionsValue.DeserializeParameterDefinitionsValue(property1.Value)); + } + } + parameters = dictionary; + continue; + } + if (property0.NameEquals("policyDefinitions")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(PolicyDefinitionReference.DeserializePolicyDefinitionReference(item)); + } + } + policyDefinitions = array; + continue; + } + if (property0.NameEquals("policyDefinitionGroups")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(PolicyDefinitionGroup.DeserializePolicyDefinitionGroup(item)); + } + } + policyDefinitionGroups = array; + continue; + } + } + continue; + } + } + return new PolicySetDefinition(id, name, type, policyType, displayName, description, metadata, parameters, policyDefinitions, policyDefinitionGroups); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySetDefinition.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySetDefinition.cs new file mode 100644 index 000000000000..81d19deeb75c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySetDefinition.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// The policy set definition. + public partial class PolicySetDefinition + { + /// Initializes a new instance of PolicySetDefinition. + public PolicySetDefinition() + { + } + + /// Initializes a new instance of PolicySetDefinition. + /// The ID of the policy set definition. + /// The name of the policy set definition. + /// The type of the resource (Microsoft.Authorization/policySetDefinitions). + /// The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. + /// The display name of the policy set definition. + /// The policy set definition description. + /// The policy set definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. + /// The policy set definition parameters that can be used in policy definition references. + /// An array of policy definition references. + /// The metadata describing groups of policy definition references within the policy set definition. + internal PolicySetDefinition(string id, string name, string type, PolicyType? policyType, string displayName, string description, object metadata, IDictionary parameters, IList policyDefinitions, IList policyDefinitionGroups) + { + Id = id; + Name = name; + Type = type; + PolicyType = policyType; + DisplayName = displayName; + Description = description; + Metadata = metadata; + Parameters = parameters; + PolicyDefinitions = policyDefinitions; + PolicyDefinitionGroups = policyDefinitionGroups; + } + + /// The ID of the policy set definition. + public string Id { get; } + /// The name of the policy set definition. + public string Name { get; } + /// The type of the resource (Microsoft.Authorization/policySetDefinitions). + public string Type { get; } + /// The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. + public PolicyType? PolicyType { get; set; } + /// The display name of the policy set definition. + public string DisplayName { get; set; } + /// The policy set definition description. + public string Description { get; set; } + /// The policy set definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. + public object Metadata { get; set; } + /// The policy set definition parameters that can be used in policy definition references. + public IDictionary Parameters { get; set; } + /// An array of policy definition references. + public IList PolicyDefinitions { get; set; } + /// The metadata describing groups of policy definition references within the policy set definition. + public IList PolicyDefinitionGroups { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySetDefinitionListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySetDefinitionListResult.Serialization.cs new file mode 100644 index 000000000000..fdd1e4b4bce6 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySetDefinitionListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class PolicySetDefinitionListResult + { + internal static PolicySetDefinitionListResult DeserializePolicySetDefinitionListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(PolicySetDefinition.DeserializePolicySetDefinition(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new PolicySetDefinitionListResult(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySetDefinitionListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySetDefinitionListResult.cs new file mode 100644 index 000000000000..1855231b9d43 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySetDefinitionListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// List of policy set definitions. + public partial class PolicySetDefinitionListResult + { + /// Initializes a new instance of PolicySetDefinitionListResult. + internal PolicySetDefinitionListResult() + { + } + + /// Initializes a new instance of PolicySetDefinitionListResult. + /// An array of policy set definitions. + /// The URL to use for getting the next set of results. + internal PolicySetDefinitionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of policy set definitions. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySku.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySku.Serialization.cs new file mode 100644 index 000000000000..0564e67d9edf --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySku.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class PolicySku : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + if (Tier != null) + { + writer.WritePropertyName("tier"); + writer.WriteStringValue(Tier); + } + writer.WriteEndObject(); + } + + internal static PolicySku DeserializePolicySku(JsonElement element) + { + string name = default; + string tier = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("tier")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tier = property.Value.GetString(); + continue; + } + } + return new PolicySku(name, tier); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySku.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySku.cs new file mode 100644 index 000000000000..dbab89241bc8 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicySku.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// The policy sku. This property is optional, obsolete, and will be ignored. + public partial class PolicySku + { + /// Initializes a new instance of PolicySku. + /// The name of the policy sku. Possible values are A0 and A1. + public PolicySku(string name) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + Name = name; + } + + /// Initializes a new instance of PolicySku. + /// The name of the policy sku. Possible values are A0 and A1. + /// The policy sku tier. Possible values are Free and Standard. + internal PolicySku(string name, string tier) + { + Name = name; + Tier = tier; + } + + /// The name of the policy sku. Possible values are A0 and A1. + public string Name { get; set; } + /// The policy sku tier. Possible values are Free and Standard. + public string Tier { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyType.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyType.cs new file mode 100644 index 000000000000..418fdad8efe3 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PolicyType.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Management.Resources.Models +{ + /// The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. + public readonly partial struct PolicyType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + public PolicyType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotSpecifiedValue = "NotSpecified"; + private const string BuiltInValue = "BuiltIn"; + private const string CustomValue = "Custom"; + private const string StaticValue = "Static"; + + /// NotSpecified. + public static PolicyType NotSpecified { get; } = new PolicyType(NotSpecifiedValue); + /// BuiltIn. + public static PolicyType BuiltIn { get; } = new PolicyType(BuiltInValue); + /// Custom. + public static PolicyType Custom { get; } = new PolicyType(CustomValue); + /// Static. + public static PolicyType Static { get; } = new PolicyType(StaticValue); + /// Determines if two values are the same. + public static bool operator ==(PolicyType left, PolicyType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PolicyType left, PolicyType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PolicyType(string value) => new PolicyType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PolicyType other && Equals(other); + /// + public bool Equals(PolicyType 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/resources/Azure.Management.Resources/src/Generated/Models/PropertyChangeType.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PropertyChangeType.Serialization.cs new file mode 100644 index 000000000000..44b524d38c93 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PropertyChangeType.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class PropertyChangeTypeExtensions + { + public static string ToSerialString(this PropertyChangeType value) => value switch + { + PropertyChangeType.Create => "Create", + PropertyChangeType.Delete => "Delete", + PropertyChangeType.Modify => "Modify", + PropertyChangeType.Array => "Array", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown PropertyChangeType value.") + }; + + public static PropertyChangeType ToPropertyChangeType(this string value) + { + if (string.Equals(value, "Create", StringComparison.InvariantCultureIgnoreCase)) return PropertyChangeType.Create; + if (string.Equals(value, "Delete", StringComparison.InvariantCultureIgnoreCase)) return PropertyChangeType.Delete; + if (string.Equals(value, "Modify", StringComparison.InvariantCultureIgnoreCase)) return PropertyChangeType.Modify; + if (string.Equals(value, "Array", StringComparison.InvariantCultureIgnoreCase)) return PropertyChangeType.Array; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown PropertyChangeType value."); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/PropertyChangeType.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PropertyChangeType.cs new file mode 100644 index 000000000000..7abc5a19768f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/PropertyChangeType.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The type of property change. + public enum PropertyChangeType + { + /// The property does not exist in the current state but is present in the desired state. The property will be created when the deployment is executed. + Create, + /// The property exists in the current state and is missing from the desired state. It will be deleted when the deployment is executed. + Delete, + /// The property exists in both current and desired state and is different. The value of the property will change when the deployment is executed. + Modify, + /// The property is an array and contains nested changes. + Array + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Provider.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Provider.Serialization.cs new file mode 100644 index 000000000000..9feb76f4f71f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Provider.Serialization.cs @@ -0,0 +1,86 @@ +// 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.Management.Resources.Models +{ + public partial class Provider + { + internal static Provider DeserializeProvider(JsonElement element) + { + string id = default; + string @namespace = default; + string registrationState = default; + string registrationPolicy = default; + IReadOnlyList resourceTypes = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("registrationState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + registrationState = property.Value.GetString(); + continue; + } + if (property.NameEquals("registrationPolicy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + registrationPolicy = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceTypes")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ProviderResourceType.DeserializeProviderResourceType(item)); + } + } + resourceTypes = array; + continue; + } + } + return new Provider(id, @namespace, registrationState, registrationPolicy, resourceTypes); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Provider.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Provider.cs new file mode 100644 index 000000000000..0c5867af57c9 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Provider.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Resource provider information. + public partial class Provider + { + /// Initializes a new instance of Provider. + internal Provider() + { + } + + /// Initializes a new instance of Provider. + /// The provider ID. + /// The namespace of the resource provider. + /// The registration state of the resource provider. + /// The registration policy of the resource provider. + /// The collection of provider resource types. + internal Provider(string id, string @namespace, string registrationState, string registrationPolicy, IReadOnlyList resourceTypes) + { + Id = id; + Namespace = @namespace; + RegistrationState = registrationState; + RegistrationPolicy = registrationPolicy; + ResourceTypes = resourceTypes; + } + + /// The provider ID. + public string Id { get; } + /// The namespace of the resource provider. + public string Namespace { get; } + /// The registration state of the resource provider. + public string RegistrationState { get; } + /// The registration policy of the resource provider. + public string RegistrationPolicy { get; } + /// The collection of provider resource types. + public IReadOnlyList ResourceTypes { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ProviderListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProviderListResult.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ProviderListResult.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ProviderListResult.Serialization.cs index a15b2b48483a..56132ebfde7b 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ProviderListResult.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProviderListResult.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ProviderListResult { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ProviderListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProviderListResult.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ProviderListResult.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ProviderListResult.cs index 29ef3ac95d86..ac62a88485f2 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ProviderListResult.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProviderListResult.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// List of resource providers. public partial class ProviderListResult diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProviderResourceType.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProviderResourceType.Serialization.cs new file mode 100644 index 000000000000..9e928da144d5 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProviderResourceType.Serialization.cs @@ -0,0 +1,132 @@ +// 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.Management.Resources.Models +{ + public partial class ProviderResourceType + { + internal static ProviderResourceType DeserializeProviderResourceType(JsonElement element) + { + string resourceType = default; + IReadOnlyList locations = default; + IReadOnlyList aliases = default; + IReadOnlyList apiVersions = default; + string capabilities = default; + IReadOnlyDictionary properties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = property.Value.GetString(); + continue; + } + if (property.NameEquals("locations")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + locations = array; + continue; + } + if (property.NameEquals("aliases")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(Alias.DeserializeAlias(item)); + } + } + aliases = array; + continue; + } + if (property.NameEquals("apiVersions")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + apiVersions = array; + continue; + } + if (property.NameEquals("capabilities")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capabilities = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + properties = dictionary; + continue; + } + } + return new ProviderResourceType(resourceType, locations, aliases, apiVersions, capabilities, properties); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProviderResourceType.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProviderResourceType.cs new file mode 100644 index 000000000000..29b503087549 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProviderResourceType.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Resource type managed by the resource provider. + public partial class ProviderResourceType + { + /// Initializes a new instance of ProviderResourceType. + internal ProviderResourceType() + { + } + + /// Initializes a new instance of ProviderResourceType. + /// The resource type. + /// The collection of locations where this resource type can be created. + /// The aliases that are supported by this resource type. + /// The API version. + /// The additional capabilities offered by this resource type. + /// The properties. + internal ProviderResourceType(string resourceType, IReadOnlyList locations, IReadOnlyList aliases, IReadOnlyList apiVersions, string capabilities, IReadOnlyDictionary properties) + { + ResourceType = resourceType; + Locations = locations; + Aliases = aliases; + ApiVersions = apiVersions; + Capabilities = capabilities; + Properties = properties; + } + + /// The resource type. + public string ResourceType { get; } + /// The collection of locations where this resource type can be created. + public IReadOnlyList Locations { get; } + /// The aliases that are supported by this resource type. + public IReadOnlyList Aliases { get; } + /// The API version. + public IReadOnlyList ApiVersions { get; } + /// The additional capabilities offered by this resource type. + public string Capabilities { get; } + /// The properties. + public IReadOnlyDictionary Properties { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProvisioningOperation.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProvisioningOperation.Serialization.cs new file mode 100644 index 000000000000..a7b01388b59e --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProvisioningOperation.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class ProvisioningOperationExtensions + { + public static string ToSerialString(this ProvisioningOperation value) => value switch + { + ProvisioningOperation.NotSpecified => "NotSpecified", + ProvisioningOperation.Create => "Create", + ProvisioningOperation.Delete => "Delete", + ProvisioningOperation.Waiting => "Waiting", + ProvisioningOperation.AzureAsyncOperationWaiting => "AzureAsyncOperationWaiting", + ProvisioningOperation.ResourceCacheWaiting => "ResourceCacheWaiting", + ProvisioningOperation.Action => "Action", + ProvisioningOperation.Read => "Read", + ProvisioningOperation.EvaluateDeploymentOutput => "EvaluateDeploymentOutput", + ProvisioningOperation.DeploymentCleanup => "DeploymentCleanup", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ProvisioningOperation value.") + }; + + public static ProvisioningOperation ToProvisioningOperation(this string value) + { + if (string.Equals(value, "NotSpecified", StringComparison.InvariantCultureIgnoreCase)) return ProvisioningOperation.NotSpecified; + if (string.Equals(value, "Create", StringComparison.InvariantCultureIgnoreCase)) return ProvisioningOperation.Create; + if (string.Equals(value, "Delete", StringComparison.InvariantCultureIgnoreCase)) return ProvisioningOperation.Delete; + if (string.Equals(value, "Waiting", StringComparison.InvariantCultureIgnoreCase)) return ProvisioningOperation.Waiting; + if (string.Equals(value, "AzureAsyncOperationWaiting", StringComparison.InvariantCultureIgnoreCase)) return ProvisioningOperation.AzureAsyncOperationWaiting; + if (string.Equals(value, "ResourceCacheWaiting", StringComparison.InvariantCultureIgnoreCase)) return ProvisioningOperation.ResourceCacheWaiting; + if (string.Equals(value, "Action", StringComparison.InvariantCultureIgnoreCase)) return ProvisioningOperation.Action; + if (string.Equals(value, "Read", StringComparison.InvariantCultureIgnoreCase)) return ProvisioningOperation.Read; + if (string.Equals(value, "EvaluateDeploymentOutput", StringComparison.InvariantCultureIgnoreCase)) return ProvisioningOperation.EvaluateDeploymentOutput; + if (string.Equals(value, "DeploymentCleanup", StringComparison.InvariantCultureIgnoreCase)) return ProvisioningOperation.DeploymentCleanup; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ProvisioningOperation value."); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProvisioningOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProvisioningOperation.cs new file mode 100644 index 000000000000..f3480672c4a6 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProvisioningOperation.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The name of the current provisioning operation. + public enum ProvisioningOperation + { + /// The provisioning operation is not specified. + NotSpecified, + /// The provisioning operation is create. + Create, + /// The provisioning operation is delete. + Delete, + /// The provisioning operation is waiting. + Waiting, + /// The provisioning operation is waiting Azure async operation. + AzureAsyncOperationWaiting, + /// The provisioning operation is waiting for resource cache. + ResourceCacheWaiting, + /// The provisioning operation is action. + Action, + /// The provisioning operation is read. + Read, + /// The provisioning operation is evaluate output. + EvaluateDeploymentOutput, + /// The provisioning operation is cleanup. This operation is part of the 'complete' mode deployment. + DeploymentCleanup + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProvisioningState.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..8d9303670f8d --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Management.Resources.Models +{ + /// Provisioning status of the managed application. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AcceptedValue = "Accepted"; + private const string RunningValue = "Running"; + private const string ReadyValue = "Ready"; + private const string CreatingValue = "Creating"; + private const string CreatedValue = "Created"; + private const string DeletingValue = "Deleting"; + private const string DeletedValue = "Deleted"; + private const string CanceledValue = "Canceled"; + private const string FailedValue = "Failed"; + private const string SucceededValue = "Succeeded"; + private const string UpdatingValue = "Updating"; + + /// Accepted. + public static ProvisioningState Accepted { get; } = new ProvisioningState(AcceptedValue); + /// Running. + public static ProvisioningState Running { get; } = new ProvisioningState(RunningValue); + /// Ready. + public static ProvisioningState Ready { get; } = new ProvisioningState(ReadyValue); + /// Creating. + public static ProvisioningState Creating { get; } = new ProvisioningState(CreatingValue); + /// Created. + public static ProvisioningState Created { get; } = new ProvisioningState(CreatedValue); + /// Deleting. + public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + /// Deleted. + public static ProvisioningState Deleted { get; } = new ProvisioningState(DeletedValue); + /// Canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// Failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Succeeded. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Updating. + public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState 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/resources/Azure.Management.Resources/src/Generated/Models/RegionCategory.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/RegionCategory.cs new file mode 100644 index 000000000000..7f1ee16da802 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/RegionCategory.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Management.Resources.Models +{ + /// The category of the region. + public readonly partial struct RegionCategory : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + public RegionCategory(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string RecommendedValue = "Recommended"; + private const string OtherValue = "Other"; + + /// Recommended. + public static RegionCategory Recommended { get; } = new RegionCategory(RecommendedValue); + /// Other. + public static RegionCategory Other { get; } = new RegionCategory(OtherValue); + /// Determines if two values are the same. + public static bool operator ==(RegionCategory left, RegionCategory right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RegionCategory left, RegionCategory right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RegionCategory(string value) => new RegionCategory(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RegionCategory other && Equals(other); + /// + public bool Equals(RegionCategory 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/resources/Azure.Management.Resources/src/Generated/Models/RegionType.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/RegionType.cs new file mode 100644 index 000000000000..1a2daef378a2 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/RegionType.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Management.Resources.Models +{ + /// The type of the region. + public readonly partial struct RegionType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + public RegionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PhysicalValue = "Physical"; + private const string LogicalValue = "Logical"; + + /// Physical. + public static RegionType Physical { get; } = new RegionType(PhysicalValue); + /// Logical. + public static RegionType Logical { get; } = new RegionType(LogicalValue); + /// Determines if two values are the same. + public static bool operator ==(RegionType left, RegionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RegionType left, RegionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RegionType(string value) => new RegionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RegionType other && Equals(other); + /// + public bool Equals(RegionType 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/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Resource.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Resource.Serialization.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Resource.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/Resource.Serialization.cs index 50fc680b287e..a7c1409899bb 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Resource.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Resource.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class Resource : IUtf8JsonSerializable { diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Resource.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..532ead598a74 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Resource.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Specified resource. + public partial class Resource + { + /// Initializes a new instance of Resource. + public Resource() + { + } + + /// Initializes a new instance of Resource. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + internal Resource(string id, string name, string type, string location, IDictionary tags) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + } + + /// Resource ID. + public string Id { get; } + /// Resource name. + public string Name { get; } + /// Resource type. + public string Type { get; } + /// Resource location. + public string Location { get; set; } + /// Resource tags. + public IDictionary Tags { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroup.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroup.Serialization.cs new file mode 100644 index 000000000000..719b7c8b8137 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroup.Serialization.cs @@ -0,0 +1,146 @@ +// 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.Management.Resources.Models +{ + public partial class ResourceGroup : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + if (Properties != null) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + if (ManagedBy != null) + { + writer.WritePropertyName("managedBy"); + writer.WriteStringValue(ManagedBy); + } + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static ResourceGroup DeserializeResourceGroup(JsonElement element) + { + string id = default; + string name = default; + string type = default; + ResourceGroupProperties properties = default; + string location = default; + string managedBy = default; + IDictionary tags = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ResourceGroupProperties.DeserializeResourceGroupProperties(property.Value); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("managedBy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + } + return new ResourceGroup(id, name, type, properties, location, managedBy, tags); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroup.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroup.cs new file mode 100644 index 000000000000..6ea4f86bf3ab --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroup.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; + +namespace Azure.Management.Resources.Models +{ + /// Resource group information. + public partial class ResourceGroup + { + /// Initializes a new instance of ResourceGroup. + /// The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations. + public ResourceGroup(string location) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + Location = location; + } + + /// Initializes a new instance of ResourceGroup. + /// The ID of the resource group. + /// The name of the resource group. + /// The type of the resource group. + /// The resource group properties. + /// The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations. + /// The ID of the resource that manages this resource group. + /// The tags attached to the resource group. + internal ResourceGroup(string id, string name, string type, ResourceGroupProperties properties, string location, string managedBy, IDictionary tags) + { + Id = id; + Name = name; + Type = type; + Properties = properties; + Location = location; + ManagedBy = managedBy; + Tags = tags; + } + + /// The ID of the resource group. + public string Id { get; } + /// The name of the resource group. + public string Name { get; } + /// The type of the resource group. + public string Type { get; } + /// The resource group properties. + public ResourceGroupProperties Properties { get; set; } + /// The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations. + public string Location { get; set; } + /// The ID of the resource that manages this resource group. + public string ManagedBy { get; set; } + /// The tags attached to the resource group. + public IDictionary Tags { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupExportResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupExportResult.Serialization.cs new file mode 100644 index 000000000000..0cb204eeb7f8 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupExportResult.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ResourceGroupExportResult + { + internal static ResourceGroupExportResult DeserializeResourceGroupExportResult(JsonElement element) + { + object template = default; + ErrorResponse error = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("template")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + template = property.Value.GetObject(); + continue; + } + if (property.NameEquals("error")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ErrorResponse.DeserializeErrorResponse(property.Value); + continue; + } + } + return new ResourceGroupExportResult(template, error); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupExportResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupExportResult.cs new file mode 100644 index 000000000000..28a833123b54 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupExportResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Resource group export result. + public partial class ResourceGroupExportResult + { + /// Initializes a new instance of ResourceGroupExportResult. + internal ResourceGroupExportResult() + { + } + + /// Initializes a new instance of ResourceGroupExportResult. + /// The template content. + /// The template export error. + internal ResourceGroupExportResult(object template, ErrorResponse error) + { + Template = template; + Error = error; + } + + /// The template content. + public object Template { get; } + /// The template export error. + public ErrorResponse Error { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupFilter.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupFilter.cs similarity index 95% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupFilter.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupFilter.cs index 633568162ab3..5430a9dab735 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupFilter.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupFilter.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Resource group filter. internal partial class ResourceGroupFilter diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupListResult.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupListResult.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupListResult.Serialization.cs index 3ac7b2bbda21..d0354b68e5ed 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupListResult.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupListResult.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ResourceGroupListResult { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupListResult.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupListResult.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupListResult.cs index c0020aed108f..83aa76231de6 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupListResult.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupListResult.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// List of resource groups. public partial class ResourceGroupListResult diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupPatchable.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupPatchable.Serialization.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupPatchable.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupPatchable.Serialization.cs index 4a761b8a9ac6..3f5fccd2019d 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupPatchable.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupPatchable.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ResourceGroupPatchable : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupPatchable.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupPatchable.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupPatchable.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupPatchable.cs index aceb727ee488..6b65eb119239 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupPatchable.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupPatchable.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Resource group information. public partial class ResourceGroupPatchable diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupProperties.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupProperties.Serialization.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupProperties.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupProperties.Serialization.cs index 15ef214d6598..4046e3c42dd0 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupProperties.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupProperties.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ResourceGroupProperties : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupProperties.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupProperties.cs similarity index 94% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupProperties.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupProperties.cs index 6eed5bcdd619..d6f128cc7956 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupProperties.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceGroupProperties.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// The resource group properties. public partial class ResourceGroupProperties diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceIdentityType.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceIdentityType.Serialization.cs new file mode 100644 index 000000000000..aedc330d6621 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceIdentityType.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class ResourceIdentityTypeExtensions + { + public static string ToSerialString(this ResourceIdentityType value) => value switch + { + ResourceIdentityType.SystemAssigned => "SystemAssigned", + ResourceIdentityType.None => "None", + ResourceIdentityType.UserAssigned => "UserAssigned", + ResourceIdentityType.SystemAssignedUserAssigned => "SystemAssigned, UserAssigned", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ResourceIdentityType value.") + }; + + public static ResourceIdentityType ToResourceIdentityType(this string value) + { + if (string.Equals(value, "SystemAssigned", StringComparison.InvariantCultureIgnoreCase)) return ResourceIdentityType.SystemAssigned; + if (string.Equals(value, "None", StringComparison.InvariantCultureIgnoreCase)) return ResourceIdentityType.None; + if (string.Equals(value, "UserAssigned", StringComparison.InvariantCultureIgnoreCase)) return ResourceIdentityType.UserAssigned; + if (string.Equals(value, "SystemAssigned, UserAssigned", StringComparison.InvariantCultureIgnoreCase)) return ResourceIdentityType.SystemAssignedUserAssigned; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ResourceIdentityType value."); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceIdentityType.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 000000000000..74b31db96693 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceIdentityType.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The identity type. + public enum ResourceIdentityType + { + /// SystemAssigned. + SystemAssigned, + /// None. + None, + /// UserAssigned. + UserAssigned, + /// SystemAssigned, UserAssigned. + SystemAssignedUserAssigned + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLink.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLink.Serialization.cs new file mode 100644 index 000000000000..95a47a9bddc9 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLink.Serialization.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ResourceLink : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteObjectValue(Type); + } + if (Properties != null) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static ResourceLink DeserializeResourceLink(JsonElement element) + { + string id = default; + string name = default; + object type = default; + ResourceLinkProperties properties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetObject(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ResourceLinkProperties.DeserializeResourceLinkProperties(property.Value); + continue; + } + } + return new ResourceLink(id, name, type, properties); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLink.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLink.cs new file mode 100644 index 000000000000..3ec3e0c00d6c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLink.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The resource link. + public partial class ResourceLink + { + /// Initializes a new instance of ResourceLink. + public ResourceLink() + { + } + + /// Initializes a new instance of ResourceLink. + /// The fully qualified ID of the resource link. + /// The name of the resource link. + /// The resource link object. + /// Properties for resource link. + internal ResourceLink(string id, string name, object type, ResourceLinkProperties properties) + { + Id = id; + Name = name; + Type = type; + Properties = properties; + } + + /// The fully qualified ID of the resource link. + public string Id { get; } + /// The name of the resource link. + public string Name { get; } + /// The resource link object. + public object Type { get; } + /// Properties for resource link. + public ResourceLinkProperties Properties { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkFilter.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkFilter.cs new file mode 100644 index 000000000000..d7f2c2c5c764 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkFilter.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// Resource link filter. + internal partial class ResourceLinkFilter + { + /// Initializes a new instance of ResourceLinkFilter. + /// The ID of the target resource. + internal ResourceLinkFilter(string targetId) + { + if (targetId == null) + { + throw new ArgumentNullException(nameof(targetId)); + } + + TargetId = targetId; + } + + /// The ID of the target resource. + public string TargetId { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkProperties.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkProperties.Serialization.cs new file mode 100644 index 000000000000..2e73ba96570e --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkProperties.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.Management.Resources.Models +{ + public partial class ResourceLinkProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (SourceId != null) + { + writer.WritePropertyName("sourceId"); + writer.WriteStringValue(SourceId); + } + writer.WritePropertyName("targetId"); + writer.WriteStringValue(TargetId); + if (Notes != null) + { + writer.WritePropertyName("notes"); + writer.WriteStringValue(Notes); + } + writer.WriteEndObject(); + } + + internal static ResourceLinkProperties DeserializeResourceLinkProperties(JsonElement element) + { + string sourceId = default; + string targetId = default; + string notes = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourceId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetId")) + { + targetId = property.Value.GetString(); + continue; + } + if (property.NameEquals("notes")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + notes = property.Value.GetString(); + continue; + } + } + return new ResourceLinkProperties(sourceId, targetId, notes); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkProperties.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkProperties.cs new file mode 100644 index 000000000000..ecc551fa18ec --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkProperties.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// The resource link properties. + public partial class ResourceLinkProperties + { + /// Initializes a new instance of ResourceLinkProperties. + /// The fully qualified ID of the target resource in the link. + public ResourceLinkProperties(string targetId) + { + if (targetId == null) + { + throw new ArgumentNullException(nameof(targetId)); + } + + TargetId = targetId; + } + + /// Initializes a new instance of ResourceLinkProperties. + /// The fully qualified ID of the source resource in the link. + /// The fully qualified ID of the target resource in the link. + /// Notes about the resource link. + internal ResourceLinkProperties(string sourceId, string targetId, string notes) + { + SourceId = sourceId; + TargetId = targetId; + Notes = notes; + } + + /// The fully qualified ID of the source resource in the link. + public string SourceId { get; } + /// The fully qualified ID of the target resource in the link. + public string TargetId { get; set; } + /// Notes about the resource link. + public string Notes { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkResult.Serialization.cs new file mode 100644 index 000000000000..0204736e9cfa --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkResult.Serialization.cs @@ -0,0 +1,52 @@ +// 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.Management.Resources.Models +{ + public partial class ResourceLinkResult + { + internal static ResourceLinkResult DeserializeResourceLinkResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ResourceLink.DeserializeResourceLink(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new ResourceLinkResult(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkResult.cs new file mode 100644 index 000000000000..cd85ae522632 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceLinkResult.cs @@ -0,0 +1,43 @@ +// 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.Management.Resources.Models +{ + /// List of resource links. + public partial class ResourceLinkResult + { + /// Initializes a new instance of ResourceLinkResult. + /// An array of resource links. + internal ResourceLinkResult(IEnumerable value) + { + if (value == null) + { + throw new ArgumentNullException(nameof(value)); + } + + Value = value.ToArray(); + } + + /// Initializes a new instance of ResourceLinkResult. + /// An array of resource links. + /// The URL to use for getting the next set of results. + internal ResourceLinkResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of resource links. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceListResult.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceListResult.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceListResult.Serialization.cs index 0a1f67c29a5c..10ad4eb16849 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceListResult.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceListResult.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ResourceListResult { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceListResult.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceListResult.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceListResult.cs index a0efde5844af..2bb0a77049be 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceListResult.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceListResult.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// List of resource groups. public partial class ResourceListResult diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceProviderOperationDisplayProperties.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceProviderOperationDisplayProperties.cs new file mode 100644 index 000000000000..d0b7830044f2 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceProviderOperationDisplayProperties.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Resource provider operation's display properties. + internal partial class ResourceProviderOperationDisplayProperties + { + /// Initializes a new instance of ResourceProviderOperationDisplayProperties. + internal ResourceProviderOperationDisplayProperties() + { + } + + /// Initializes a new instance of ResourceProviderOperationDisplayProperties. + /// Operation description. + /// Operation provider. + /// Operation resource. + /// Resource provider operation. + /// Operation description. + internal ResourceProviderOperationDisplayProperties(string publisher, string provider, string resource, string operation, string description) + { + Publisher = publisher; + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + } + + /// Operation description. + public string Publisher { get; set; } + /// Operation provider. + public string Provider { get; set; } + /// Operation resource. + public string Resource { get; set; } + /// Resource provider operation. + public string Operation { get; set; } + /// Operation description. + public string Description { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceReference.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceReference.Serialization.cs new file mode 100644 index 000000000000..77da600cc6b1 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceReference.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ResourceReference + { + internal static ResourceReference DeserializeResourceReference(JsonElement element) + { + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + } + return new ResourceReference(id); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceReference.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceReference.cs new file mode 100644 index 000000000000..024977cd276f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourceReference.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The resource Id model. + public partial class ResourceReference + { + /// Initializes a new instance of ResourceReference. + internal ResourceReference() + { + } + + /// Initializes a new instance of ResourceReference. + /// The fully qualified resource Id. + internal ResourceReference(string id) + { + Id = id; + } + + /// The fully qualified resource Id. + public string Id { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourcesMoveInfo.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourcesMoveInfo.Serialization.cs similarity index 95% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourcesMoveInfo.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourcesMoveInfo.Serialization.cs index 01656d43a31b..2daacc07e45c 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourcesMoveInfo.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourcesMoveInfo.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ResourcesMoveInfo : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourcesMoveInfo.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourcesMoveInfo.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourcesMoveInfo.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourcesMoveInfo.cs index ca4859ee3c11..56dc7259460c 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourcesMoveInfo.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ResourcesMoveInfo.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Parameters of move resources. public partial class ResourcesMoveInfo diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScopedDeployment.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScopedDeployment.Serialization.cs new file mode 100644 index 000000000000..6241f88bbcef --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScopedDeployment.Serialization.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ScopedDeployment : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScopedDeployment.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScopedDeployment.cs new file mode 100644 index 000000000000..a142fd6435c6 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScopedDeployment.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; + +namespace Azure.Management.Resources.Models +{ + /// Deployment operation parameters. + public partial class ScopedDeployment + { + /// Initializes a new instance of ScopedDeployment. + /// The location to store the deployment data. + /// The deployment properties. + public ScopedDeployment(string location, DeploymentProperties properties) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (properties == null) + { + throw new ArgumentNullException(nameof(properties)); + } + + Location = location; + Properties = properties; + } + + /// Initializes a new instance of ScopedDeployment. + /// The location to store the deployment data. + /// The deployment properties. + /// Deployment tags. + internal ScopedDeployment(string location, DeploymentProperties properties, IDictionary tags) + { + Location = location; + Properties = properties; + Tags = tags; + } + + /// The location to store the deployment data. + public string Location { get; } + /// The deployment properties. + public DeploymentProperties Properties { get; } + /// Deployment tags. + public IDictionary Tags { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptConfigurationBase.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptConfigurationBase.Serialization.cs new file mode 100644 index 000000000000..c0136d146e96 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptConfigurationBase.Serialization.cs @@ -0,0 +1,178 @@ +// 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; + +namespace Azure.Management.Resources.Models +{ + public partial class ScriptConfigurationBase : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (PrimaryScriptUri != null) + { + writer.WritePropertyName("primaryScriptUri"); + writer.WriteStringValue(PrimaryScriptUri); + } + if (SupportingScriptUris != null) + { + writer.WritePropertyName("supportingScriptUris"); + writer.WriteStartArray(); + foreach (var item in SupportingScriptUris) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (ScriptContent != null) + { + writer.WritePropertyName("scriptContent"); + writer.WriteStringValue(ScriptContent); + } + if (Arguments != null) + { + writer.WritePropertyName("arguments"); + writer.WriteStringValue(Arguments); + } + if (EnvironmentVariables != null) + { + writer.WritePropertyName("environmentVariables"); + writer.WriteStartArray(); + foreach (var item in EnvironmentVariables) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (ForceUpdateTag != null) + { + writer.WritePropertyName("forceUpdateTag"); + writer.WriteStringValue(ForceUpdateTag); + } + writer.WritePropertyName("retentionInterval"); + writer.WriteStringValue(RetentionInterval, "P"); + if (Timeout != null) + { + writer.WritePropertyName("timeout"); + writer.WriteStringValue(Timeout.Value, "P"); + } + writer.WriteEndObject(); + } + + internal static ScriptConfigurationBase DeserializeScriptConfigurationBase(JsonElement element) + { + string primaryScriptUri = default; + IList supportingScriptUris = default; + string scriptContent = default; + string arguments = default; + IList environmentVariables = default; + string forceUpdateTag = default; + TimeSpan retentionInterval = default; + TimeSpan? timeout = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("primaryScriptUri")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + primaryScriptUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("supportingScriptUris")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + supportingScriptUris = array; + continue; + } + if (property.NameEquals("scriptContent")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scriptContent = property.Value.GetString(); + continue; + } + if (property.NameEquals("arguments")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + arguments = property.Value.GetString(); + continue; + } + if (property.NameEquals("environmentVariables")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(EnvironmentVariable.DeserializeEnvironmentVariable(item)); + } + } + environmentVariables = array; + continue; + } + if (property.NameEquals("forceUpdateTag")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + forceUpdateTag = property.Value.GetString(); + continue; + } + if (property.NameEquals("retentionInterval")) + { + retentionInterval = property.Value.GetTimeSpan("P"); + continue; + } + if (property.NameEquals("timeout")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeout = property.Value.GetTimeSpan("P"); + continue; + } + } + return new ScriptConfigurationBase(primaryScriptUri, supportingScriptUris, scriptContent, arguments, environmentVariables, forceUpdateTag, retentionInterval, timeout); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptConfigurationBase.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptConfigurationBase.cs new file mode 100644 index 000000000000..99029f8dc45d --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptConfigurationBase.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Common configuration settings for both Azure PowerShell and Azure CLI scripts. + public partial class ScriptConfigurationBase + { + /// Initializes a new instance of ScriptConfigurationBase. + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + public ScriptConfigurationBase(TimeSpan retentionInterval) + { + RetentionInterval = retentionInterval; + } + + /// Initializes a new instance of ScriptConfigurationBase. + /// Uri for the script. This is the entry point for the external script. + /// Supporting files for the external script. + /// Script body. + /// Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'. + /// The environment variables to pass over to the script. + /// Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be current time stamp or a GUID. + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + /// Maximum allowed script execution time specified in ISO 8601 format. Default value is PT1H. + internal ScriptConfigurationBase(string primaryScriptUri, IList supportingScriptUris, string scriptContent, string arguments, IList environmentVariables, string forceUpdateTag, TimeSpan retentionInterval, TimeSpan? timeout) + { + PrimaryScriptUri = primaryScriptUri; + SupportingScriptUris = supportingScriptUris; + ScriptContent = scriptContent; + Arguments = arguments; + EnvironmentVariables = environmentVariables; + ForceUpdateTag = forceUpdateTag; + RetentionInterval = retentionInterval; + Timeout = timeout; + } + + /// Uri for the script. This is the entry point for the external script. + public string PrimaryScriptUri { get; set; } + /// Supporting files for the external script. + public IList SupportingScriptUris { get; set; } + /// Script body. + public string ScriptContent { get; set; } + /// Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'. + public string Arguments { get; set; } + /// The environment variables to pass over to the script. + public IList EnvironmentVariables { get; set; } + /// Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be current time stamp or a GUID. + public string ForceUpdateTag { get; set; } + /// Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P7D means one week). + public TimeSpan RetentionInterval { get; set; } + /// Maximum allowed script execution time specified in ISO 8601 format. Default value is PT1H. + public TimeSpan? Timeout { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptLog.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptLog.Serialization.cs new file mode 100644 index 000000000000..202e16840468 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptLog.Serialization.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ScriptLog : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Log != null) + { + writer.WritePropertyName("log"); + writer.WriteStringValue(Log); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ScriptLog DeserializeScriptLog(JsonElement element) + { + string id = default; + string name = default; + string type = default; + string log = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("log")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + log = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ScriptLog(id, name, type, log); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptLog.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptLog.cs new file mode 100644 index 000000000000..886b93f696b8 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptLog.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Script execution log object. + public partial class ScriptLog : AzureResourceBase + { + /// Initializes a new instance of ScriptLog. + public ScriptLog() + { + } + + /// Initializes a new instance of ScriptLog. + /// String Id used to locate any resource on Azure. + /// Name of this resource. + /// Type of this resource. + /// Script execution logs in text format. + internal ScriptLog(string id, string name, string type, string log) : base(id, name, type) + { + Log = log; + } + + /// Script execution logs in text format. + public string Log { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptLogsList.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptLogsList.Serialization.cs new file mode 100644 index 000000000000..5af101657150 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptLogsList.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.Management.Resources.Models +{ + public partial class ScriptLogsList + { + internal static ScriptLogsList DeserializeScriptLogsList(JsonElement element) + { + IReadOnlyList value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ScriptLog.DeserializeScriptLog(item)); + } + } + value = array; + continue; + } + } + return new ScriptLogsList(value); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptLogsList.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptLogsList.cs new file mode 100644 index 000000000000..f95002dd1827 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptLogsList.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Deployment script execution logs. + public partial class ScriptLogsList + { + /// Initializes a new instance of ScriptLogsList. + internal ScriptLogsList() + { + } + + /// Initializes a new instance of ScriptLogsList. + /// Deployment scripts logs. + internal ScriptLogsList(IReadOnlyList value) + { + Value = value; + } + + /// Deployment scripts logs. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptProvisioningState.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptProvisioningState.cs new file mode 100644 index 000000000000..eff1c36dd297 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptProvisioningState.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Management.Resources.Models +{ + /// State of the script execution. This only appears in the response. + public readonly partial struct ScriptProvisioningState : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + public ScriptProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string ProvisioningResourcesValue = "ProvisioningResources"; + private const string RunningValue = "Running"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Creating. + public static ScriptProvisioningState Creating { get; } = new ScriptProvisioningState(CreatingValue); + /// ProvisioningResources. + public static ScriptProvisioningState ProvisioningResources { get; } = new ScriptProvisioningState(ProvisioningResourcesValue); + /// Running. + public static ScriptProvisioningState Running { get; } = new ScriptProvisioningState(RunningValue); + /// Succeeded. + public static ScriptProvisioningState Succeeded { get; } = new ScriptProvisioningState(SucceededValue); + /// Failed. + public static ScriptProvisioningState Failed { get; } = new ScriptProvisioningState(FailedValue); + /// Canceled. + public static ScriptProvisioningState Canceled { get; } = new ScriptProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ScriptProvisioningState left, ScriptProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScriptProvisioningState left, ScriptProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ScriptProvisioningState(string value) => new ScriptProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScriptProvisioningState other && Equals(other); + /// + public bool Equals(ScriptProvisioningState 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/resources/Azure.Management.Resources/src/Generated/Models/ScriptStatus.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptStatus.Serialization.cs new file mode 100644 index 000000000000..76b814dc3f6a --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptStatus.Serialization.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ScriptStatus : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (ContainerInstanceId != null) + { + writer.WritePropertyName("containerInstanceId"); + writer.WriteStringValue(ContainerInstanceId); + } + if (StorageAccountId != null) + { + writer.WritePropertyName("storageAccountId"); + writer.WriteStringValue(StorageAccountId); + } + if (StartTime != null) + { + writer.WritePropertyName("startTime"); + writer.WriteStringValue(StartTime.Value, "O"); + } + if (EndTime != null) + { + writer.WritePropertyName("endTime"); + writer.WriteStringValue(EndTime.Value, "O"); + } + if (ExpirationTime != null) + { + writer.WritePropertyName("expirationTime"); + writer.WriteStringValue(ExpirationTime.Value, "O"); + } + if (Error != null) + { + writer.WritePropertyName("error"); + writer.WriteObjectValue(Error); + } + writer.WriteEndObject(); + } + + internal static ScriptStatus DeserializeScriptStatus(JsonElement element) + { + string containerInstanceId = default; + string storageAccountId = default; + DateTimeOffset? startTime = default; + DateTimeOffset? endTime = default; + DateTimeOffset? expirationTime = default; + ErrorResponse error = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("containerInstanceId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerInstanceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("storageAccountId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageAccountId = property.Value.GetString(); + continue; + } + if (property.NameEquals("startTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("expirationTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expirationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("error")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ErrorResponse.DeserializeErrorResponse(property.Value); + continue; + } + } + return new ScriptStatus(containerInstanceId, storageAccountId, startTime, endTime, expirationTime, error); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptStatus.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptStatus.cs new file mode 100644 index 000000000000..9120ba7456d9 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptStatus.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// Generic object modeling results of script execution. + public partial class ScriptStatus + { + /// Initializes a new instance of ScriptStatus. + public ScriptStatus() + { + } + + /// Initializes a new instance of ScriptStatus. + /// ACI resource Id. + /// Storage account resource Id. + /// Start time of the script execution. + /// End time of the script execution. + /// Time the deployment script resource will expire. + /// Error that is relayed from the script execution. + internal ScriptStatus(string containerInstanceId, string storageAccountId, DateTimeOffset? startTime, DateTimeOffset? endTime, DateTimeOffset? expirationTime, ErrorResponse error) + { + ContainerInstanceId = containerInstanceId; + StorageAccountId = storageAccountId; + StartTime = startTime; + EndTime = endTime; + ExpirationTime = expirationTime; + Error = error; + } + + /// ACI resource Id. + public string ContainerInstanceId { get; } + /// Storage account resource Id. + public string StorageAccountId { get; } + /// Start time of the script execution. + public DateTimeOffset? StartTime { get; } + /// End time of the script execution. + public DateTimeOffset? EndTime { get; } + /// Time the deployment script resource will expire. + public DateTimeOffset? ExpirationTime { get; } + /// Error that is relayed from the script execution. + public ErrorResponse Error { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptType.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptType.cs new file mode 100644 index 000000000000..75ea559798df --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/ScriptType.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Management.Resources.Models +{ + /// Type of the script. + public readonly partial struct ScriptType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + public ScriptType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AzurePowerShellValue = "AzurePowerShell"; + private const string AzureCLIValue = "AzureCLI"; + + /// AzurePowerShell. + public static ScriptType AzurePowerShell { get; } = new ScriptType(AzurePowerShellValue); + /// AzureCLI. + public static ScriptType AzureCLI { get; } = new ScriptType(AzureCLIValue); + /// Determines if two values are the same. + public static bool operator ==(ScriptType left, ScriptType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScriptType left, ScriptType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ScriptType(string value) => new ScriptType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScriptType other && Equals(other); + /// + public bool Equals(ScriptType 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/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Sku.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Sku.Serialization.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Sku.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/Sku.Serialization.cs index 6e9cd41f7e17..0cf8a09421c3 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Sku.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Sku.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class Sku : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Sku.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Sku.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Sku.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/Sku.cs index 5f3bf2f80b54..684f70b0c2ce 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Sku.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Sku.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// SKU for the resource. public partial class Sku diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/SkuAutoGenerated.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SkuAutoGenerated.Serialization.cs new file mode 100644 index 000000000000..97d61f8f94fc --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SkuAutoGenerated.Serialization.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class SkuAutoGenerated : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + if (Tier != null) + { + writer.WritePropertyName("tier"); + writer.WriteStringValue(Tier); + } + if (Size != null) + { + writer.WritePropertyName("size"); + writer.WriteStringValue(Size); + } + if (Family != null) + { + writer.WritePropertyName("family"); + writer.WriteStringValue(Family); + } + if (Model != null) + { + writer.WritePropertyName("model"); + writer.WriteStringValue(Model); + } + if (Capacity != null) + { + writer.WritePropertyName("capacity"); + writer.WriteNumberValue(Capacity.Value); + } + writer.WriteEndObject(); + } + + internal static SkuAutoGenerated DeserializeSkuAutoGenerated(JsonElement element) + { + string name = default; + string tier = default; + string size = default; + string family = default; + string model = default; + int? capacity = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("tier")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tier = property.Value.GetString(); + continue; + } + if (property.NameEquals("size")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + size = property.Value.GetString(); + continue; + } + if (property.NameEquals("family")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + family = property.Value.GetString(); + continue; + } + if (property.NameEquals("model")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + model = property.Value.GetString(); + continue; + } + if (property.NameEquals("capacity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacity = property.Value.GetInt32(); + continue; + } + } + return new SkuAutoGenerated(name, tier, size, family, model, capacity); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/SkuAutoGenerated.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SkuAutoGenerated.cs new file mode 100644 index 000000000000..4f5281846d56 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SkuAutoGenerated.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// SKU for the resource. + public partial class SkuAutoGenerated + { + /// Initializes a new instance of SkuAutoGenerated. + /// The SKU name. + public SkuAutoGenerated(string name) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + Name = name; + } + + /// Initializes a new instance of SkuAutoGenerated. + /// The SKU name. + /// The SKU tier. + /// The SKU size. + /// The SKU family. + /// The SKU model. + /// The SKU capacity. + internal SkuAutoGenerated(string name, string tier, string size, string family, string model, int? capacity) + { + Name = name; + Tier = tier; + Size = size; + Family = family; + Model = model; + Capacity = capacity; + } + + /// The SKU name. + public string Name { get; set; } + /// The SKU tier. + public string Tier { get; set; } + /// The SKU size. + public string Size { get; set; } + /// The SKU family. + public string Family { get; set; } + /// The SKU model. + public string Model { get; set; } + /// The SKU capacity. + public int? Capacity { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/SpendingLimit.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SpendingLimit.Serialization.cs new file mode 100644 index 000000000000..274baabbca0b --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SpendingLimit.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class SpendingLimitExtensions + { + public static string ToSerialString(this SpendingLimit value) => value switch + { + SpendingLimit.On => "On", + SpendingLimit.Off => "Off", + SpendingLimit.CurrentPeriodOff => "CurrentPeriodOff", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SpendingLimit value.") + }; + + public static SpendingLimit ToSpendingLimit(this string value) + { + if (string.Equals(value, "On", StringComparison.InvariantCultureIgnoreCase)) return SpendingLimit.On; + if (string.Equals(value, "Off", StringComparison.InvariantCultureIgnoreCase)) return SpendingLimit.Off; + if (string.Equals(value, "CurrentPeriodOff", StringComparison.InvariantCultureIgnoreCase)) return SpendingLimit.CurrentPeriodOff; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SpendingLimit value."); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/SpendingLimit.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SpendingLimit.cs new file mode 100644 index 000000000000..6d927cd445d4 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SpendingLimit.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The subscription spending limit. + public enum SpendingLimit + { + /// On. + On, + /// Off. + Off, + /// CurrentPeriodOff. + CurrentPeriodOff + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/StorageAccountConfiguration.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/StorageAccountConfiguration.Serialization.cs new file mode 100644 index 000000000000..d9c0f560345e --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/StorageAccountConfiguration.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.Management.Resources.Models +{ + public partial class StorageAccountConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (StorageAccountName != null) + { + writer.WritePropertyName("storageAccountName"); + writer.WriteStringValue(StorageAccountName); + } + if (StorageAccountKey != null) + { + writer.WritePropertyName("storageAccountKey"); + writer.WriteStringValue(StorageAccountKey); + } + writer.WriteEndObject(); + } + + internal static StorageAccountConfiguration DeserializeStorageAccountConfiguration(JsonElement element) + { + string storageAccountName = default; + string storageAccountKey = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageAccountName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageAccountName = property.Value.GetString(); + continue; + } + if (property.NameEquals("storageAccountKey")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageAccountKey = property.Value.GetString(); + continue; + } + } + return new StorageAccountConfiguration(storageAccountName, storageAccountKey); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/StorageAccountConfiguration.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/StorageAccountConfiguration.cs new file mode 100644 index 000000000000..78402deea63f --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/StorageAccountConfiguration.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Settings to use an existing storage account. Valid storage account kinds are: Storage, StorageV2 and FileStorage. + public partial class StorageAccountConfiguration + { + /// Initializes a new instance of StorageAccountConfiguration. + public StorageAccountConfiguration() + { + } + + /// Initializes a new instance of StorageAccountConfiguration. + /// The storage account name. + /// The storage account access key. + internal StorageAccountConfiguration(string storageAccountName, string storageAccountKey) + { + StorageAccountName = storageAccountName; + StorageAccountKey = storageAccountKey; + } + + /// The storage account name. + public string StorageAccountName { get; set; } + /// The storage account access key. + public string StorageAccountKey { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/SubResource.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubResource.cs similarity index 93% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/SubResource.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/SubResource.cs index 0fb5e24d4518..c351cf71769b 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/SubResource.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubResource.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Sub-resource. internal partial class SubResource diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Subscription.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Subscription.Serialization.cs new file mode 100644 index 000000000000..13d243c8e83a --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Subscription.Serialization.cs @@ -0,0 +1,138 @@ +// 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.Management.Resources.Models +{ + public partial class Subscription + { + internal static Subscription DeserializeSubscription(JsonElement element) + { + string id = default; + string subscriptionId = default; + string displayName = default; + string tenantId = default; + SubscriptionState? state = default; + SubscriptionPolicies subscriptionPolicies = default; + string authorizationSource = default; + IReadOnlyList managedByTenants = default; + IReadOnlyDictionary tags = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("state")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = property.Value.GetString().ToSubscriptionState(); + continue; + } + if (property.NameEquals("subscriptionPolicies")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscriptionPolicies = SubscriptionPolicies.DeserializeSubscriptionPolicies(property.Value); + continue; + } + if (property.NameEquals("authorizationSource")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authorizationSource = property.Value.GetString(); + continue; + } + if (property.NameEquals("managedByTenants")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ManagedByTenant.DeserializeManagedByTenant(item)); + } + } + managedByTenants = array; + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + } + return new Subscription(id, subscriptionId, displayName, tenantId, state, subscriptionPolicies, authorizationSource, managedByTenants, tags); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Subscription.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Subscription.cs new file mode 100644 index 000000000000..b7bc93c30ec7 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Subscription.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Subscription information. + public partial class Subscription + { + /// Initializes a new instance of Subscription. + internal Subscription() + { + } + + /// Initializes a new instance of Subscription. + /// The fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000. + /// The subscription ID. + /// The subscription display name. + /// The subscription tenant ID. + /// The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. + /// The subscription policies. + /// The authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. + /// An array containing the tenants managing the subscription. + /// The tags attached to the subscription. + internal Subscription(string id, string subscriptionId, string displayName, string tenantId, SubscriptionState? state, SubscriptionPolicies subscriptionPolicies, string authorizationSource, IReadOnlyList managedByTenants, IReadOnlyDictionary tags) + { + Id = id; + SubscriptionId = subscriptionId; + DisplayName = displayName; + TenantId = tenantId; + State = state; + SubscriptionPolicies = subscriptionPolicies; + AuthorizationSource = authorizationSource; + ManagedByTenants = managedByTenants; + Tags = tags; + } + + /// The fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000. + public string Id { get; } + /// The subscription ID. + public string SubscriptionId { get; } + /// The subscription display name. + public string DisplayName { get; } + /// The subscription tenant ID. + public string TenantId { get; } + /// The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. + public SubscriptionState? State { get; } + /// The subscription policies. + public SubscriptionPolicies SubscriptionPolicies { get; } + /// The authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. + public string AuthorizationSource { get; } + /// An array containing the tenants managing the subscription. + public IReadOnlyList ManagedByTenants { get; } + /// The tags attached to the subscription. + public IReadOnlyDictionary Tags { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionListResult.Serialization.cs new file mode 100644 index 000000000000..e999940d9f2d --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionListResult.Serialization.cs @@ -0,0 +1,52 @@ +// 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.Management.Resources.Models +{ + public partial class SubscriptionListResult + { + internal static SubscriptionListResult DeserializeSubscriptionListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(Subscription.DeserializeSubscription(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new SubscriptionListResult(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionListResult.cs new file mode 100644 index 000000000000..1aa4c8a70a56 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionListResult.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Subscription list operation response. + public partial class SubscriptionListResult + { + /// Initializes a new instance of SubscriptionListResult. + /// The URL to get the next set of results. + internal SubscriptionListResult(string nextLink) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + NextLink = nextLink; + } + + /// Initializes a new instance of SubscriptionListResult. + /// An array of subscriptions. + /// The URL to get the next set of results. + internal SubscriptionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of subscriptions. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionPolicies.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionPolicies.Serialization.cs new file mode 100644 index 000000000000..27953dcae9e8 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionPolicies.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.Management.Resources.Models +{ + public partial class SubscriptionPolicies + { + internal static SubscriptionPolicies DeserializeSubscriptionPolicies(JsonElement element) + { + string locationPlacementId = default; + string quotaId = default; + SpendingLimit? spendingLimit = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("locationPlacementId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + locationPlacementId = property.Value.GetString(); + continue; + } + if (property.NameEquals("quotaId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quotaId = property.Value.GetString(); + continue; + } + if (property.NameEquals("spendingLimit")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + spendingLimit = property.Value.GetString().ToSpendingLimit(); + continue; + } + } + return new SubscriptionPolicies(locationPlacementId, quotaId, spendingLimit); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionPolicies.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionPolicies.cs new file mode 100644 index 000000000000..6f8f0822e4e5 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionPolicies.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Subscription policies. + public partial class SubscriptionPolicies + { + /// Initializes a new instance of SubscriptionPolicies. + internal SubscriptionPolicies() + { + } + + /// Initializes a new instance of SubscriptionPolicies. + /// The subscription location placement ID. The ID indicates which regions are visible for a subscription. For example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions. + /// The subscription quota ID. + /// The subscription spending limit. + internal SubscriptionPolicies(string locationPlacementId, string quotaId, SpendingLimit? spendingLimit) + { + LocationPlacementId = locationPlacementId; + QuotaId = quotaId; + SpendingLimit = spendingLimit; + } + + /// The subscription location placement ID. The ID indicates which regions are visible for a subscription. For example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions. + public string LocationPlacementId { get; } + /// The subscription quota ID. + public string QuotaId { get; } + /// The subscription spending limit. + public SpendingLimit? SpendingLimit { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionState.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionState.Serialization.cs new file mode 100644 index 000000000000..57370bfa19da --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionState.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class SubscriptionStateExtensions + { + public static string ToSerialString(this SubscriptionState value) => value switch + { + SubscriptionState.Enabled => "Enabled", + SubscriptionState.Warned => "Warned", + SubscriptionState.PastDue => "PastDue", + SubscriptionState.Disabled => "Disabled", + SubscriptionState.Deleted => "Deleted", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SubscriptionState value.") + }; + + public static SubscriptionState ToSubscriptionState(this string value) + { + if (string.Equals(value, "Enabled", StringComparison.InvariantCultureIgnoreCase)) return SubscriptionState.Enabled; + if (string.Equals(value, "Warned", StringComparison.InvariantCultureIgnoreCase)) return SubscriptionState.Warned; + if (string.Equals(value, "PastDue", StringComparison.InvariantCultureIgnoreCase)) return SubscriptionState.PastDue; + if (string.Equals(value, "Disabled", StringComparison.InvariantCultureIgnoreCase)) return SubscriptionState.Disabled; + if (string.Equals(value, "Deleted", StringComparison.InvariantCultureIgnoreCase)) return SubscriptionState.Deleted; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SubscriptionState value."); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionState.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionState.cs new file mode 100644 index 000000000000..dddf22ba2c86 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SubscriptionState.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. + public enum SubscriptionState + { + /// Enabled. + Enabled, + /// Warned. + Warned, + /// PastDue. + PastDue, + /// Disabled. + Disabled, + /// Deleted. + Deleted + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/SystemData.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SystemData.Serialization.cs new file mode 100644 index 000000000000..1aeec168ae76 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SystemData.Serialization.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class SystemData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (CreatedBy != null) + { + writer.WritePropertyName("createdBy"); + writer.WriteStringValue(CreatedBy); + } + if (CreatedByType != null) + { + writer.WritePropertyName("createdByType"); + writer.WriteStringValue(CreatedByType.Value.ToString()); + } + if (CreatedAt != null) + { + writer.WritePropertyName("createdAt"); + writer.WriteStringValue(CreatedAt.Value, "O"); + } + if (LastModifiedBy != null) + { + writer.WritePropertyName("lastModifiedBy"); + writer.WriteStringValue(LastModifiedBy); + } + if (LastModifiedByType != null) + { + writer.WritePropertyName("lastModifiedByType"); + writer.WriteStringValue(LastModifiedByType.Value.ToString()); + } + if (LastModifiedAt != null) + { + writer.WritePropertyName("lastModifiedAt"); + writer.WriteStringValue(LastModifiedAt.Value, "O"); + } + writer.WriteEndObject(); + } + + internal static SystemData DeserializeSystemData(JsonElement element) + { + string createdBy = default; + CreatedByType? createdByType = default; + DateTimeOffset? createdAt = default; + string lastModifiedBy = default; + CreatedByType? lastModifiedByType = default; + DateTimeOffset? lastModifiedAt = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("createdBy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdByType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdByType = new CreatedByType(property.Value.GetString()); + continue; + } + if (property.NameEquals("createdAt")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastModifiedBy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModifiedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastModifiedByType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModifiedByType = new CreatedByType(property.Value.GetString()); + continue; + } + if (property.NameEquals("lastModifiedAt")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModifiedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new SystemData(createdBy, createdByType, createdAt, lastModifiedBy, lastModifiedByType, lastModifiedAt); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/SystemData.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..62983ff07e26 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/SystemData.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// Metadata pertaining to creation and last modification of the resource. + public partial class SystemData + { + /// Initializes a new instance of SystemData. + public SystemData() + { + } + + /// Initializes a new instance of SystemData. + /// The identity that created the resource. + /// The type of identity that created the resource. + /// The timestamp of resource creation (UTC). + /// The identity that last modified the resource. + /// The type of identity that last modified the resource. + /// The type of identity that last modified the resource. + internal SystemData(string createdBy, CreatedByType? createdByType, DateTimeOffset? createdAt, string lastModifiedBy, CreatedByType? lastModifiedByType, DateTimeOffset? lastModifiedAt) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + } + + /// The identity that created the resource. + public string CreatedBy { get; set; } + /// The type of identity that created the resource. + public CreatedByType? CreatedByType { get; set; } + /// The timestamp of resource creation (UTC). + public DateTimeOffset? CreatedAt { get; set; } + /// The identity that last modified the resource. + public string LastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + public CreatedByType? LastModifiedByType { get; set; } + /// The type of identity that last modified the resource. + public DateTimeOffset? LastModifiedAt { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagCount.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagCount.Serialization.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagCount.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/TagCount.Serialization.cs index 44eeb4394b7b..41cf87bdf3ba 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagCount.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagCount.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class TagCount { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagCount.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagCount.cs similarity index 94% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagCount.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/TagCount.cs index 7a66647fff0f..d255e0e3206b 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagCount.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagCount.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Tag count. public partial class TagCount diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagDetails.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagDetails.Serialization.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagDetails.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/TagDetails.Serialization.cs index 84df8ba26bc6..0d1bbbcef287 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagDetails.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagDetails.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class TagDetails { diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagDetails.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagDetails.cs new file mode 100644 index 000000000000..4e1553298e68 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagDetails.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Tag details. + public partial class TagDetails + { + /// Initializes a new instance of TagDetails. + internal TagDetails() + { + } + + /// Initializes a new instance of TagDetails. + /// The tag name ID. + /// The tag name. + /// The total number of resources that use the resource tag. When a tag is initially created and has no associated resources, the value is 0. + /// The list of tag values. + internal TagDetails(string id, string tagName, TagCount count, IReadOnlyList values) + { + Id = id; + TagName = tagName; + Count = count; + Values = values; + } + + /// The tag name ID. + public string Id { get; } + /// The tag name. + public string TagName { get; } + /// The total number of resources that use the resource tag. When a tag is initially created and has no associated resources, the value is 0. + public TagCount Count { get; } + /// The list of tag values. + public IReadOnlyList Values { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagValue.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagValue.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagValue.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/TagValue.Serialization.cs index e41ab5dafc0a..94a50bf4d89c 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagValue.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagValue.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class TagValue { diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagValue.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagValue.cs new file mode 100644 index 000000000000..cfc5b39d6505 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagValue.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Tag information. + public partial class TagValue + { + /// Initializes a new instance of TagValue. + internal TagValue() + { + } + + /// Initializes a new instance of TagValue. + /// The tag value ID. + /// The tag value. + /// The tag value count. + internal TagValue(string id, string tagValueValue, TagCount count) + { + Id = id; + TagValueValue = tagValueValue; + Count = count; + } + + /// The tag value ID. + public string Id { get; } + /// The tag value. + public string TagValueValue { get; } + /// The tag value count. + public TagCount Count { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Tags.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Tags.Serialization.cs new file mode 100644 index 000000000000..3ed47ee694f7 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Tags.Serialization.cs @@ -0,0 +1,63 @@ +// 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.Management.Resources.Models +{ + public partial class Tags : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (TagsValue != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in TagsValue) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static Tags DeserializeTags(JsonElement element) + { + IDictionary tags = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + } + return new Tags(tags); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/Tags.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Tags.cs new file mode 100644 index 000000000000..0fffb8733fba --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/Tags.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// A dictionary of name and value pairs. + public partial class Tags + { + /// Initializes a new instance of Tags. + public Tags() + { + } + + /// Initializes a new instance of Tags. + /// Dictionary of <string>. + internal Tags(IDictionary tagsValue) + { + TagsValue = tagsValue; + } + + /// Dictionary of <string>. + public IDictionary TagsValue { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagsListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsListResult.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagsListResult.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsListResult.Serialization.cs index c3199a3d0ef9..5c37cff79aef 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagsListResult.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsListResult.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class TagsListResult { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagsListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsListResult.cs similarity index 95% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagsListResult.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsListResult.cs index 02b885eb32e6..8f8ecdebe440 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagsListResult.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsListResult.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// List of subscription tags. public partial class TagsListResult diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsPatchResource.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsPatchResource.Serialization.cs new file mode 100644 index 000000000000..bda6eff218a0 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsPatchResource.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class TagsPatchResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Operation != null) + { + writer.WritePropertyName("operation"); + writer.WriteStringValue(Operation.Value.ToString()); + } + if (Properties != null) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsPatchResource.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsPatchResource.cs new file mode 100644 index 000000000000..4c980bafdaf0 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsPatchResource.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Wrapper resource for tags patch API request only. + public partial class TagsPatchResource + { + /// Initializes a new instance of TagsPatchResource. + public TagsPatchResource() + { + } + + /// Initializes a new instance of TagsPatchResource. + /// The operation type for the patch API. + /// The set of tags. + internal TagsPatchResource(TagsPatchResourceOperation? operation, Tags properties) + { + Operation = operation; + Properties = properties; + } + + /// The operation type for the patch API. + public TagsPatchResourceOperation? Operation { get; set; } + /// The set of tags. + public Tags Properties { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsPatchResourceOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsPatchResourceOperation.cs new file mode 100644 index 000000000000..b64801106a4c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsPatchResourceOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Management.Resources.Models +{ + /// The operation type for the patch API. + public readonly partial struct TagsPatchResourceOperation : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + public TagsPatchResourceOperation(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ReplaceValue = "Replace"; + private const string MergeValue = "Merge"; + private const string DeleteValue = "Delete"; + + /// Replace. + public static TagsPatchResourceOperation Replace { get; } = new TagsPatchResourceOperation(ReplaceValue); + /// Merge. + public static TagsPatchResourceOperation Merge { get; } = new TagsPatchResourceOperation(MergeValue); + /// Delete. + public static TagsPatchResourceOperation Delete { get; } = new TagsPatchResourceOperation(DeleteValue); + /// Determines if two values are the same. + public static bool operator ==(TagsPatchResourceOperation left, TagsPatchResourceOperation right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TagsPatchResourceOperation left, TagsPatchResourceOperation right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TagsPatchResourceOperation(string value) => new TagsPatchResourceOperation(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TagsPatchResourceOperation other && Equals(other); + /// + public bool Equals(TagsPatchResourceOperation 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/resources/Azure.Management.Resources/src/Generated/Models/TagsResource.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsResource.Serialization.cs new file mode 100644 index 000000000000..4ad32d476245 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsResource.Serialization.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class TagsResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + writer.WriteEndObject(); + } + + internal static TagsResource DeserializeTagsResource(JsonElement element) + { + string id = default; + string name = default; + string type = default; + Tags properties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + properties = Tags.DeserializeTags(property.Value); + continue; + } + } + return new TagsResource(id, name, type, properties); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsResource.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsResource.cs new file mode 100644 index 000000000000..b7c35c41e347 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TagsResource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// Wrapper resource for tags API requests and responses. + public partial class TagsResource + { + /// Initializes a new instance of TagsResource. + /// The set of tags. + public TagsResource(Tags properties) + { + if (properties == null) + { + throw new ArgumentNullException(nameof(properties)); + } + + Properties = properties; + } + + /// Initializes a new instance of TagsResource. + /// The ID of the tags wrapper resource. + /// The name of the tags wrapper resource. + /// The type of the tags wrapper resource. + /// The set of tags. + internal TagsResource(string id, string name, string type, Tags properties) + { + Id = id; + Name = name; + Type = type; + Properties = properties; + } + + /// The ID of the tags wrapper resource. + public string Id { get; } + /// The name of the tags wrapper resource. + public string Name { get; } + /// The type of the tags wrapper resource. + public string Type { get; } + /// The set of tags. + public Tags Properties { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TargetResource.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TargetResource.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TargetResource.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/TargetResource.Serialization.cs index 15bb7f782582..d3df68e482f1 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TargetResource.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TargetResource.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class TargetResource { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TargetResource.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TargetResource.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TargetResource.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/TargetResource.cs index da7cd9df5781..7d5b2c5dac39 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TargetResource.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TargetResource.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Target resource. public partial class TargetResource diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TemplateHashResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TemplateHashResult.Serialization.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TemplateHashResult.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/TemplateHashResult.Serialization.cs index 4cdbcc688cfb..857c6fe9fadd 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TemplateHashResult.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TemplateHashResult.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class TemplateHashResult { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TemplateHashResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TemplateHashResult.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TemplateHashResult.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/TemplateHashResult.cs index e22e27baca9a..636ef4daf767 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TemplateHashResult.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TemplateHashResult.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Result of the request to calculate template hash. It contains a string of minified template and its hash. public partial class TemplateHashResult diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TemplateLink.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TemplateLink.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TemplateLink.Serialization.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/TemplateLink.Serialization.cs index bd422b86acfb..e6421f142bfa 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TemplateLink.Serialization.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TemplateLink.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class TemplateLink : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TemplateLink.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TemplateLink.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TemplateLink.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/Models/TemplateLink.cs index 9cf7002cdbf1..7aa765f94b3f 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TemplateLink.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TemplateLink.cs @@ -7,7 +7,7 @@ using System; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Entity representing the reference to the template. public partial class TemplateLink diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantCategory.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantCategory.Serialization.cs new file mode 100644 index 000000000000..66a670cddddd --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantCategory.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class TenantCategoryExtensions + { + public static string ToSerialString(this TenantCategory value) => value switch + { + TenantCategory.Home => "Home", + TenantCategory.ProjectedBy => "ProjectedBy", + TenantCategory.ManagedBy => "ManagedBy", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TenantCategory value.") + }; + + public static TenantCategory ToTenantCategory(this string value) + { + if (string.Equals(value, "Home", StringComparison.InvariantCultureIgnoreCase)) return TenantCategory.Home; + if (string.Equals(value, "ProjectedBy", StringComparison.InvariantCultureIgnoreCase)) return TenantCategory.ProjectedBy; + if (string.Equals(value, "ManagedBy", StringComparison.InvariantCultureIgnoreCase)) return TenantCategory.ManagedBy; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TenantCategory value."); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantCategory.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantCategory.cs new file mode 100644 index 000000000000..4543e68d7326 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantCategory.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Category of the tenant. + public enum TenantCategory + { + /// Home. + Home, + /// ProjectedBy. + ProjectedBy, + /// ManagedBy. + ManagedBy + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantIdDescription.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantIdDescription.Serialization.cs new file mode 100644 index 000000000000..90a375e10d2a --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantIdDescription.Serialization.cs @@ -0,0 +1,106 @@ +// 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.Management.Resources.Models +{ + public partial class TenantIdDescription + { + internal static TenantIdDescription DeserializeTenantIdDescription(JsonElement element) + { + string id = default; + string tenantId = default; + TenantCategory? tenantCategory = default; + string country = default; + string countryCode = default; + string displayName = default; + IReadOnlyList domains = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantCategory")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tenantCategory = property.Value.GetString().ToTenantCategory(); + continue; + } + if (property.NameEquals("country")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + country = property.Value.GetString(); + continue; + } + if (property.NameEquals("countryCode")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + countryCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("domains")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + domains = array; + continue; + } + } + return new TenantIdDescription(id, tenantId, tenantCategory, country, countryCode, displayName, domains); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantIdDescription.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantIdDescription.cs new file mode 100644 index 000000000000..19d3c92c1544 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantIdDescription.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Tenant Id information. + public partial class TenantIdDescription + { + /// Initializes a new instance of TenantIdDescription. + internal TenantIdDescription() + { + } + + /// Initializes a new instance of TenantIdDescription. + /// The fully qualified ID of the tenant. For example, /tenants/00000000-0000-0000-0000-000000000000. + /// The tenant ID. For example, 00000000-0000-0000-0000-000000000000. + /// Category of the tenant. + /// Country/region name of the address for the tenant. + /// Country/region abbreviation for the tenant. + /// The display name of the tenant. + /// The list of domains for the tenant. + internal TenantIdDescription(string id, string tenantId, TenantCategory? tenantCategory, string country, string countryCode, string displayName, IReadOnlyList domains) + { + Id = id; + TenantId = tenantId; + TenantCategory = tenantCategory; + Country = country; + CountryCode = countryCode; + DisplayName = displayName; + Domains = domains; + } + + /// The fully qualified ID of the tenant. For example, /tenants/00000000-0000-0000-0000-000000000000. + public string Id { get; } + /// The tenant ID. For example, 00000000-0000-0000-0000-000000000000. + public string TenantId { get; } + /// Category of the tenant. + public TenantCategory? TenantCategory { get; } + /// Country/region name of the address for the tenant. + public string Country { get; } + /// Country/region abbreviation for the tenant. + public string CountryCode { get; } + /// The display name of the tenant. + public string DisplayName { get; } + /// The list of domains for the tenant. + public IReadOnlyList Domains { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantListResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantListResult.Serialization.cs new file mode 100644 index 000000000000..9dda22d2beae --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantListResult.Serialization.cs @@ -0,0 +1,52 @@ +// 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.Management.Resources.Models +{ + public partial class TenantListResult + { + internal static TenantListResult DeserializeTenantListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(TenantIdDescription.DeserializeTenantIdDescription(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new TenantListResult(value, nextLink); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantListResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantListResult.cs new file mode 100644 index 000000000000..611aef69a002 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/TenantListResult.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Tenant Ids information. + public partial class TenantListResult + { + /// Initializes a new instance of TenantListResult. + /// The URL to use for getting the next set of results. + internal TenantListResult(string nextLink) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + NextLink = nextLink; + } + + /// Initializes a new instance of TenantListResult. + /// An array of tenants. + /// The URL to use for getting the next set of results. + internal TenantListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of tenants. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/UserAssignedIdentity.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/UserAssignedIdentity.Serialization.cs new file mode 100644 index 000000000000..c39a41c41876 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/UserAssignedIdentity.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.Management.Resources.Models +{ + public partial class UserAssignedIdentity : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (PrincipalId != null) + { + writer.WritePropertyName("principalId"); + writer.WriteStringValue(PrincipalId); + } + if (ClientId != null) + { + writer.WritePropertyName("clientId"); + writer.WriteStringValue(ClientId); + } + writer.WriteEndObject(); + } + + internal static UserAssignedIdentity DeserializeUserAssignedIdentity(JsonElement element) + { + string principalId = default; + string clientId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + principalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientId = property.Value.GetString(); + continue; + } + } + return new UserAssignedIdentity(principalId, clientId); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/UserAssignedIdentity.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/UserAssignedIdentity.cs new file mode 100644 index 000000000000..e2c595607004 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/UserAssignedIdentity.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// User-assigned managed identity. + public partial class UserAssignedIdentity + { + /// Initializes a new instance of UserAssignedIdentity. + public UserAssignedIdentity() + { + } + + /// Initializes a new instance of UserAssignedIdentity. + /// Azure Active Directory principal ID associated with this identity. + /// Client App Id associated with this identity. + internal UserAssignedIdentity(string principalId, string clientId) + { + PrincipalId = principalId; + ClientId = clientId; + } + + /// Azure Active Directory principal ID associated with this identity. + public string PrincipalId { get; set; } + /// Client App Id associated with this identity. + public string ClientId { get; set; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfChange.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfChange.Serialization.cs new file mode 100644 index 000000000000..2091200d3c1c --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfChange.Serialization.cs @@ -0,0 +1,78 @@ +// 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.Management.Resources.Models +{ + public partial class WhatIfChange + { + internal static WhatIfChange DeserializeWhatIfChange(JsonElement element) + { + string resourceId = default; + ChangeType changeType = default; + object before = default; + object after = default; + IReadOnlyList delta = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId")) + { + resourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("changeType")) + { + changeType = property.Value.GetString().ToChangeType(); + continue; + } + if (property.NameEquals("before")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + before = property.Value.GetObject(); + continue; + } + if (property.NameEquals("after")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + after = property.Value.GetObject(); + continue; + } + if (property.NameEquals("delta")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(WhatIfPropertyChange.DeserializeWhatIfPropertyChange(item)); + } + } + delta = array; + continue; + } + } + return new WhatIfChange(resourceId, changeType, before, after, delta); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfChange.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfChange.cs new file mode 100644 index 000000000000..5d393116de97 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfChange.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Information about a single resource change predicted by What-If operation. + public partial class WhatIfChange + { + /// Initializes a new instance of WhatIfChange. + /// Resource ID. + /// Type of change that will be made to the resource when the deployment is executed. + internal WhatIfChange(string resourceId, ChangeType changeType) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + + ResourceId = resourceId; + ChangeType = changeType; + } + + /// Initializes a new instance of WhatIfChange. + /// Resource ID. + /// Type of change that will be made to the resource when the deployment is executed. + /// The snapshot of the resource before the deployment is executed. + /// The predicted snapshot of the resource after the deployment is executed. + /// The predicted changes to resource properties. + internal WhatIfChange(string resourceId, ChangeType changeType, object before, object after, IReadOnlyList delta) + { + ResourceId = resourceId; + ChangeType = changeType; + Before = before; + After = after; + Delta = delta; + } + + /// Resource ID. + public string ResourceId { get; } + /// Type of change that will be made to the resource when the deployment is executed. + public ChangeType ChangeType { get; } + /// The snapshot of the resource before the deployment is executed. + public object Before { get; } + /// The predicted snapshot of the resource after the deployment is executed. + public object After { get; } + /// The predicted changes to resource properties. + public IReadOnlyList Delta { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfOperationResult.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfOperationResult.Serialization.cs new file mode 100644 index 000000000000..ed3cf2ec25ac --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfOperationResult.Serialization.cs @@ -0,0 +1,73 @@ +// 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.Management.Resources.Models +{ + public partial class WhatIfOperationResult + { + internal static WhatIfOperationResult DeserializeWhatIfOperationResult(JsonElement element) + { + string status = default; + ErrorResponse error = default; + IReadOnlyList changes = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("error")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ErrorResponse.DeserializeErrorResponse(property.Value); + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("changes")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(WhatIfChange.DeserializeWhatIfChange(item)); + } + } + changes = array; + continue; + } + } + continue; + } + } + return new WhatIfOperationResult(status, error, changes); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfOperationResult.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfOperationResult.cs new file mode 100644 index 000000000000..e5c2c59048ec --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfOperationResult.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + public partial class WhatIfOperationResult + { + /// Initializes a new instance of WhatIfOperationResult. + internal WhatIfOperationResult() + { + } + + /// Initializes a new instance of WhatIfOperationResult. + /// Status of the What-If operation. + /// Error when What-If operation fails. + /// List of resource changes predicted by What-If operation. + internal WhatIfOperationResult(string status, ErrorResponse error, IReadOnlyList changes) + { + Status = status; + Error = error; + Changes = changes; + } + + /// Status of the What-If operation. + public string Status { get; } + /// Error when What-If operation fails. + public ErrorResponse Error { get; } + /// List of resource changes predicted by What-If operation. + public IReadOnlyList Changes { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfPropertyChange.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfPropertyChange.Serialization.cs new file mode 100644 index 000000000000..9c16967a3666 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfPropertyChange.Serialization.cs @@ -0,0 +1,78 @@ +// 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.Management.Resources.Models +{ + public partial class WhatIfPropertyChange + { + internal static WhatIfPropertyChange DeserializeWhatIfPropertyChange(JsonElement element) + { + string path = default; + PropertyChangeType propertyChangeType = default; + object before = default; + object after = default; + IReadOnlyList children = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("path")) + { + path = property.Value.GetString(); + continue; + } + if (property.NameEquals("propertyChangeType")) + { + propertyChangeType = property.Value.GetString().ToPropertyChangeType(); + continue; + } + if (property.NameEquals("before")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + before = property.Value.GetObject(); + continue; + } + if (property.NameEquals("after")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + after = property.Value.GetObject(); + continue; + } + if (property.NameEquals("children")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(DeserializeWhatIfPropertyChange(item)); + } + } + children = array; + continue; + } + } + return new WhatIfPropertyChange(path, propertyChangeType, before, after, children); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfPropertyChange.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfPropertyChange.cs new file mode 100644 index 000000000000..1c34c839408d --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfPropertyChange.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// The predicted change to the resource property. + public partial class WhatIfPropertyChange + { + /// Initializes a new instance of WhatIfPropertyChange. + /// The path of the property. + /// The type of property change. + internal WhatIfPropertyChange(string path, PropertyChangeType propertyChangeType) + { + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + + Path = path; + PropertyChangeType = propertyChangeType; + } + + /// Initializes a new instance of WhatIfPropertyChange. + /// The path of the property. + /// The type of property change. + /// The value of the property before the deployment is executed. + /// The value of the property after the deployment is executed. + /// Nested property changes. + internal WhatIfPropertyChange(string path, PropertyChangeType propertyChangeType, object before, object after, IReadOnlyList children) + { + Path = path; + PropertyChangeType = propertyChangeType; + Before = before; + After = after; + Children = children; + } + + /// The path of the property. + public string Path { get; } + /// The type of property change. + public PropertyChangeType PropertyChangeType { get; } + /// The value of the property before the deployment is executed. + public object Before { get; } + /// The value of the property after the deployment is executed. + public object After { get; } + /// Nested property changes. + public IReadOnlyList Children { get; } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfResultFormat.Serialization.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfResultFormat.Serialization.cs new file mode 100644 index 000000000000..a4daf651fd62 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfResultFormat.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class WhatIfResultFormatExtensions + { + public static string ToSerialString(this WhatIfResultFormat value) => value switch + { + WhatIfResultFormat.ResourceIdOnly => "ResourceIdOnly", + WhatIfResultFormat.FullResourcePayloads => "FullResourcePayloads", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown WhatIfResultFormat value.") + }; + + public static WhatIfResultFormat ToWhatIfResultFormat(this string value) + { + if (string.Equals(value, "ResourceIdOnly", StringComparison.InvariantCultureIgnoreCase)) return WhatIfResultFormat.ResourceIdOnly; + if (string.Equals(value, "FullResourcePayloads", StringComparison.InvariantCultureIgnoreCase)) return WhatIfResultFormat.FullResourcePayloads; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown WhatIfResultFormat value."); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfResultFormat.cs b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfResultFormat.cs new file mode 100644 index 000000000000..819e1c106bdf --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/Models/WhatIfResultFormat.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The format of the What-If results. + public enum WhatIfResultFormat + { + /// ResourceIdOnly. + ResourceIdOnly, + /// FullResourcePayloads. + FullResourcePayloads + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/OperationsClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/OperationsClient.cs new file mode 100644 index 000000000000..b47011b0b8b9 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/OperationsClient.cs @@ -0,0 +1,113 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The Operations service client. + public partial class OperationsClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal OperationsRestClient RestClient { get; } + /// Initializes a new instance of OperationsClient for mocking. + protected OperationsClient() + { + } + /// Initializes a new instance of OperationsClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + internal OperationsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + RestClient = new OperationsRestClient(clientDiagnostics, pipeline, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Lists all of the available Microsoft.Resources REST API operations. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("OperationsClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(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("OperationsClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, 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); + } + + /// Lists all of the available Microsoft.Resources REST API operations. + /// The cancellation token to use. + public virtual Pageable List(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("OperationsClient.List"); + scope.Start(); + try + { + var response = RestClient.List(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("OperationsClient.List"); + scope.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/OperationsRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/OperationsRestClient.cs new file mode 100644 index 000000000000..2cd2fc6979f8 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/OperationsRestClient.cs @@ -0,0 +1,183 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class OperationsRestClient + { + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of OperationsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + public OperationsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + endpoint ??= new Uri("https://management.azure.com"); + + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Resources/operations", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Lists all of the available Microsoft.Resources REST API operations. + /// The cancellation token to use. + public async ValueTask> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists all of the available Microsoft.Resources REST API operations. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListNextPageRequest(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; + return message; + } + + /// Lists all of the available Microsoft.Resources REST API operations. + /// The URL to the next page of results. + /// The cancellation token to use. + public async ValueTask> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists all of the available Microsoft.Resources REST API operations. + /// The URL to the next page of results. + /// The cancellation token to use. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/PolicyAssignmentsClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/PolicyAssignmentsClient.cs new file mode 100644 index 000000000000..3e012cb259f6 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/PolicyAssignmentsClient.cs @@ -0,0 +1,654 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The PolicyAssignments service client. + public partial class PolicyAssignmentsClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal PolicyAssignmentsRestClient RestClient { get; } + /// Initializes a new instance of PolicyAssignmentsClient for mocking. + protected PolicyAssignmentsClient() + { + } + /// Initializes a new instance of PolicyAssignmentsClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal PolicyAssignmentsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new PolicyAssignmentsRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The name of the policy assignment to delete. + /// The cancellation token to use. + public virtual async Task> DeleteAsync(string scope, string policyAssignmentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.Delete"); + scope0.Start(); + try + { + return await RestClient.DeleteAsync(scope, policyAssignmentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The name of the policy assignment to delete. + /// The cancellation token to use. + public virtual Response Delete(string scope, string policyAssignmentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.Delete"); + scope0.Start(); + try + { + return RestClient.Delete(scope, policyAssignmentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + /// The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The name of the policy assignment. + /// Parameters for the policy assignment. + /// The cancellation token to use. + public virtual async Task> CreateAsync(string scope, string policyAssignmentName, PolicyAssignment parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.Create"); + scope0.Start(); + try + { + return await RestClient.CreateAsync(scope, policyAssignmentName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + /// The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The name of the policy assignment. + /// Parameters for the policy assignment. + /// The cancellation token to use. + public virtual Response Create(string scope, string policyAssignmentName, PolicyAssignment parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.Create"); + scope0.Start(); + try + { + return RestClient.Create(scope, policyAssignmentName, parameters, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation retrieves a single policy assignment, given its name and the scope it was created at. + /// The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The name of the policy assignment to get. + /// The cancellation token to use. + public virtual async Task> GetAsync(string scope, string policyAssignmentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.Get"); + scope0.Start(); + try + { + return await RestClient.GetAsync(scope, policyAssignmentName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation retrieves a single policy assignment, given its name and the scope it was created at. + /// The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The name of the policy assignment to get. + /// The cancellation token to use. + public virtual Response Get(string scope, string policyAssignmentName, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.Get"); + scope0.Start(); + try + { + return RestClient.Get(scope, policyAssignmentName, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + /// The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// The cancellation token to use. + public virtual async Task> DeleteByIdAsync(string policyAssignmentId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.DeleteById"); + scope0.Start(); + try + { + return await RestClient.DeleteByIdAsync(policyAssignmentId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + /// The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// The cancellation token to use. + public virtual Response DeleteById(string policyAssignmentId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.DeleteById"); + scope0.Start(); + try + { + return RestClient.DeleteById(policyAssignmentId, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// Parameters for policy assignment. + /// The cancellation token to use. + public virtual async Task> CreateByIdAsync(string policyAssignmentId, PolicyAssignment parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.CreateById"); + scope0.Start(); + try + { + return await RestClient.CreateByIdAsync(policyAssignmentId, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// Parameters for policy assignment. + /// The cancellation token to use. + public virtual Response CreateById(string policyAssignmentId, PolicyAssignment parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.CreateById"); + scope0.Start(); + try + { + return RestClient.CreateById(policyAssignmentId, parameters, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// The cancellation token to use. + public virtual async Task> GetByIdAsync(string policyAssignmentId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.GetById"); + scope0.Start(); + try + { + return await RestClient.GetByIdAsync(policyAssignmentId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// The cancellation token to use. + public virtual Response GetById(string policyAssignmentId, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.GetById"); + scope0.Start(); + try + { + return RestClient.GetById(policyAssignmentId, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + /// The name of the resource group that contains policy assignments. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public virtual AsyncPageable ListForResourceGroupAsync(string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.ListForResourceGroup"); + scope0.Start(); + try + { + var response = await RestClient.ListForResourceGroupAsync(resourceGroupName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.ListForResourceGroup"); + scope0.Start(); + try + { + var response = await RestClient.ListForResourceGroupNextPageAsync(nextLink, resourceGroupName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + /// The name of the resource group that contains policy assignments. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public virtual Pageable ListForResourceGroup(string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.ListForResourceGroup"); + scope0.Start(); + try + { + var response = RestClient.ListForResourceGroup(resourceGroupName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.ListForResourceGroup"); + scope0.Start(); + try + { + var response = RestClient.ListForResourceGroupNextPage(nextLink, resourceGroupName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + /// The name of the resource group containing the resource. + /// The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines). + /// The parent resource path. Use empty string if there is none. + /// The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + /// The name of the resource. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public virtual AsyncPageable ListForResourceAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.ListForResource"); + scope0.Start(); + try + { + var response = await RestClient.ListForResourceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.ListForResource"); + scope0.Start(); + try + { + var response = await RestClient.ListForResourceNextPageAsync(nextLink, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + /// The name of the resource group containing the resource. + /// The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines). + /// The parent resource path. Use empty string if there is none. + /// The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + /// The name of the resource. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public virtual Pageable ListForResource(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.ListForResource"); + scope0.Start(); + try + { + var response = RestClient.ListForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.ListForResource"); + scope0.Start(); + try + { + var response = RestClient.ListForResourceNextPage(nextLink, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// This operation retrieves the list of all policy assignments applicable to the management group that match the given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter=atScope() is provided, the returned list includes all policy assignments that are assigned to the management group or the management group's ancestors. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the management group. + /// The ID of the management group. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. A filter is required when listing policy assignments at management group scope. + /// The cancellation token to use. + public virtual AsyncPageable ListForManagementGroupAsync(string managementGroupId, string filter, CancellationToken cancellationToken = default) + { + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.ListForManagementGroup"); + scope0.Start(); + try + { + var response = await RestClient.ListForManagementGroupAsync(managementGroupId, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.ListForManagementGroup"); + scope0.Start(); + try + { + var response = await RestClient.ListForManagementGroupNextPageAsync(nextLink, managementGroupId, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// This operation retrieves the list of all policy assignments applicable to the management group that match the given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter=atScope() is provided, the returned list includes all policy assignments that are assigned to the management group or the management group's ancestors. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the management group. + /// The ID of the management group. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. A filter is required when listing policy assignments at management group scope. + /// The cancellation token to use. + public virtual Pageable ListForManagementGroup(string managementGroupId, string filter, CancellationToken cancellationToken = default) + { + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.ListForManagementGroup"); + scope0.Start(); + try + { + var response = RestClient.ListForManagementGroup(managementGroupId, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.ListForManagementGroup"); + scope0.Start(); + try + { + var response = RestClient.ListForManagementGroupNextPage(nextLink, managementGroupId, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(string filter = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.List"); + scope0.Start(); + try + { + var response = await RestClient.ListAsync(filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.List"); + scope0.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public virtual Pageable List(string filter = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.List"); + scope0.Start(); + try + { + var response = RestClient.List(filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsClient.List"); + scope0.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/PolicyAssignmentsRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/PolicyAssignmentsRestClient.cs new file mode 100644 index 000000000000..4664cdb99ed9 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/PolicyAssignmentsRestClient.cs @@ -0,0 +1,1389 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class PolicyAssignmentsRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of PolicyAssignmentsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public PolicyAssignmentsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateDeleteRequest(string scope, string policyAssignmentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Authorization/policyAssignments/", false); + uri.AppendPath(policyAssignmentName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The name of the policy assignment to delete. + /// The cancellation token to use. + public async ValueTask> DeleteAsync(string scope, string policyAssignmentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (policyAssignmentName == null) + { + throw new ArgumentNullException(nameof(policyAssignmentName)); + } + + using var message = CreateDeleteRequest(scope, policyAssignmentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignment value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + case 204: + return Response.FromValue(null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The name of the policy assignment to delete. + /// The cancellation token to use. + public Response Delete(string scope, string policyAssignmentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (policyAssignmentName == null) + { + throw new ArgumentNullException(nameof(policyAssignmentName)); + } + + using var message = CreateDeleteRequest(scope, policyAssignmentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignment value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + case 204: + return Response.FromValue(null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateRequest(string scope, string policyAssignmentName, PolicyAssignment parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Authorization/policyAssignments/", false); + uri.AppendPath(policyAssignmentName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + /// The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The name of the policy assignment. + /// Parameters for the policy assignment. + /// The cancellation token to use. + public async ValueTask> CreateAsync(string scope, string policyAssignmentName, PolicyAssignment parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (policyAssignmentName == null) + { + throw new ArgumentNullException(nameof(policyAssignmentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateRequest(scope, policyAssignmentName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + { + PolicyAssignment value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + /// The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The name of the policy assignment. + /// Parameters for the policy assignment. + /// The cancellation token to use. + public Response Create(string scope, string policyAssignmentName, PolicyAssignment parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (policyAssignmentName == null) + { + throw new ArgumentNullException(nameof(policyAssignmentName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateRequest(scope, policyAssignmentName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + { + PolicyAssignment value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetRequest(string scope, string policyAssignmentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Authorization/policyAssignments/", false); + uri.AppendPath(policyAssignmentName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves a single policy assignment, given its name and the scope it was created at. + /// The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The name of the policy assignment to get. + /// The cancellation token to use. + public async ValueTask> GetAsync(string scope, string policyAssignmentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (policyAssignmentName == null) + { + throw new ArgumentNullException(nameof(policyAssignmentName)); + } + + using var message = CreateGetRequest(scope, policyAssignmentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignment value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves a single policy assignment, given its name and the scope it was created at. + /// The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The name of the policy assignment to get. + /// The cancellation token to use. + public Response Get(string scope, string policyAssignmentName, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (policyAssignmentName == null) + { + throw new ArgumentNullException(nameof(policyAssignmentName)); + } + + using var message = CreateGetRequest(scope, policyAssignmentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignment value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListForResourceGroupRequest(string resourceGroupName, string filter) + { + 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.Authorization/policyAssignments", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, false); + } + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + /// The name of the resource group that contains policy assignments. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public async ValueTask> ListForResourceGroupAsync(string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListForResourceGroupRequest(resourceGroupName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + /// The name of the resource group that contains policy assignments. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public Response ListForResourceGroup(string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListForResourceGroupRequest(resourceGroupName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListForResourceRequest(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter) + { + 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/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/", false); + uri.AppendPath(parentResourcePath, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceType, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.Authorization/policyAssignments", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + /// The name of the resource group containing the resource. + /// The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines). + /// The parent resource path. Use empty string if there is none. + /// The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + /// The name of the resource. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public async ValueTask> ListForResourceAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + + using var message = CreateListForResourceRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + /// The name of the resource group containing the resource. + /// The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines). + /// The parent resource path. Use empty string if there is none. + /// The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + /// The name of the resource. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public Response ListForResource(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + + using var message = CreateListForResourceRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListForManagementGroupRequest(string managementGroupId, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementgroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Authorization/policyAssignments", false); + uri.AppendQuery("$filter", filter, false); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves the list of all policy assignments applicable to the management group that match the given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter=atScope() is provided, the returned list includes all policy assignments that are assigned to the management group or the management group's ancestors. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the management group. + /// The ID of the management group. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. A filter is required when listing policy assignments at management group scope. + /// The cancellation token to use. + public async ValueTask> ListForManagementGroupAsync(string managementGroupId, string filter, CancellationToken cancellationToken = default) + { + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListForManagementGroupRequest(managementGroupId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the list of all policy assignments applicable to the management group that match the given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter=atScope() is provided, the returned list includes all policy assignments that are assigned to the management group or the management group's ancestors. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the management group. + /// The ID of the management group. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. A filter is required when listing policy assignments at management group scope. + /// The cancellation token to use. + public Response ListForManagementGroup(string managementGroupId, string filter, CancellationToken cancellationToken = default) + { + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListForManagementGroupRequest(managementGroupId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListRequest(string filter) + { + 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.Authorization/policyAssignments", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public async ValueTask> ListAsync(string filter = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public Response List(string filter = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteByIdRequest(string policyAssignmentId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(policyAssignmentId, false); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + /// The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// The cancellation token to use. + public async ValueTask> DeleteByIdAsync(string policyAssignmentId, CancellationToken cancellationToken = default) + { + if (policyAssignmentId == null) + { + throw new ArgumentNullException(nameof(policyAssignmentId)); + } + + using var message = CreateDeleteByIdRequest(policyAssignmentId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignment value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + case 204: + return Response.FromValue(null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + /// The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// The cancellation token to use. + public Response DeleteById(string policyAssignmentId, CancellationToken cancellationToken = default) + { + if (policyAssignmentId == null) + { + throw new ArgumentNullException(nameof(policyAssignmentId)); + } + + using var message = CreateDeleteByIdRequest(policyAssignmentId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignment value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + case 204: + return Response.FromValue(null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateByIdRequest(string policyAssignmentId, PolicyAssignment parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(policyAssignmentId, false); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// Parameters for policy assignment. + /// The cancellation token to use. + public async ValueTask> CreateByIdAsync(string policyAssignmentId, PolicyAssignment parameters, CancellationToken cancellationToken = default) + { + if (policyAssignmentId == null) + { + throw new ArgumentNullException(nameof(policyAssignmentId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateByIdRequest(policyAssignmentId, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + { + PolicyAssignment value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// Parameters for policy assignment. + /// The cancellation token to use. + public Response CreateById(string policyAssignmentId, PolicyAssignment parameters, CancellationToken cancellationToken = default) + { + if (policyAssignmentId == null) + { + throw new ArgumentNullException(nameof(policyAssignmentId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateByIdRequest(policyAssignmentId, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + { + PolicyAssignment value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetByIdRequest(string policyAssignmentId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(policyAssignmentId, false); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// The cancellation token to use. + public async ValueTask> GetByIdAsync(string policyAssignmentId, CancellationToken cancellationToken = default) + { + if (policyAssignmentId == null) + { + throw new ArgumentNullException(nameof(policyAssignmentId)); + } + + using var message = CreateGetByIdRequest(policyAssignmentId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignment value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + /// The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + /// The cancellation token to use. + public Response GetById(string policyAssignmentId, CancellationToken cancellationToken = default) + { + if (policyAssignmentId == null) + { + throw new ArgumentNullException(nameof(policyAssignmentId)); + } + + using var message = CreateGetByIdRequest(policyAssignmentId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignment value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListForResourceGroupNextPageRequest(string nextLink, string resourceGroupName, string filter) + { + 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; + return message; + } + + /// This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + /// The URL to the next page of results. + /// The name of the resource group that contains policy assignments. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public async ValueTask> ListForResourceGroupNextPageAsync(string nextLink, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListForResourceGroupNextPageRequest(nextLink, resourceGroupName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + /// The URL to the next page of results. + /// The name of the resource group that contains policy assignments. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public Response ListForResourceGroupNextPage(string nextLink, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListForResourceGroupNextPageRequest(nextLink, resourceGroupName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListForResourceNextPageRequest(string nextLink, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter) + { + 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; + return message; + } + + /// This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + /// The URL to the next page of results. + /// The name of the resource group containing the resource. + /// The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines). + /// The parent resource path. Use empty string if there is none. + /// The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + /// The name of the resource. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public async ValueTask> ListForResourceNextPageAsync(string nextLink, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + + using var message = CreateListForResourceNextPageRequest(nextLink, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + /// The URL to the next page of results. + /// The name of the resource group containing the resource. + /// The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines). + /// The parent resource path. Use empty string if there is none. + /// The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + /// The name of the resource. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public Response ListForResourceNextPage(string nextLink, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + + using var message = CreateListForResourceNextPageRequest(nextLink, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListForManagementGroupNextPageRequest(string nextLink, string managementGroupId, string filter) + { + 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; + return message; + } + + /// This operation retrieves the list of all policy assignments applicable to the management group that match the given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter=atScope() is provided, the returned list includes all policy assignments that are assigned to the management group or the management group's ancestors. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the management group. + /// The URL to the next page of results. + /// The ID of the management group. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. A filter is required when listing policy assignments at management group scope. + /// The cancellation token to use. + public async ValueTask> ListForManagementGroupNextPageAsync(string nextLink, string managementGroupId, string filter, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListForManagementGroupNextPageRequest(nextLink, managementGroupId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the list of all policy assignments applicable to the management group that match the given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter=atScope() is provided, the returned list includes all policy assignments that are assigned to the management group or the management group's ancestors. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the management group. + /// The URL to the next page of results. + /// The ID of the management group. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. A filter is required when listing policy assignments at management group scope. + /// The cancellation token to use. + public Response ListForManagementGroupNextPage(string nextLink, string managementGroupId, string filter, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListForManagementGroupNextPageRequest(nextLink, managementGroupId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListNextPageRequest(string nextLink, string filter) + { + 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; + return message; + } + + /// This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + /// The URL to the next page of results. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public async ValueTask> ListNextPageAsync(string nextLink, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + /// The URL to the next page of results. + /// The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + /// The cancellation token to use. + public Response ListNextPage(string nextLink, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyAssignmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/PolicyDefinitionsClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/PolicyDefinitionsClient.cs new file mode 100644 index 000000000000..a4213f9be91b --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/PolicyDefinitionsClient.cs @@ -0,0 +1,536 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The PolicyDefinitions service client. + public partial class PolicyDefinitionsClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal PolicyDefinitionsRestClient RestClient { get; } + /// Initializes a new instance of PolicyDefinitionsClient for mocking. + protected PolicyDefinitionsClient() + { + } + /// Initializes a new instance of PolicyDefinitionsClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal PolicyDefinitionsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new PolicyDefinitionsRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// This operation creates or updates a policy definition in the given subscription with the given name. + /// The name of the policy definition to create. + /// The policy definition properties. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAsync(string policyDefinitionName, PolicyDefinition parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.CreateOrUpdate"); + scope.Start(); + try + { + return await RestClient.CreateOrUpdateAsync(policyDefinitionName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation creates or updates a policy definition in the given subscription with the given name. + /// The name of the policy definition to create. + /// The policy definition properties. + /// The cancellation token to use. + public virtual Response CreateOrUpdate(string policyDefinitionName, PolicyDefinition parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.CreateOrUpdate"); + scope.Start(); + try + { + return RestClient.CreateOrUpdate(policyDefinitionName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation deletes the policy definition in the given subscription with the given name. + /// The name of the policy definition to delete. + /// The cancellation token to use. + public virtual async Task DeleteAsync(string policyDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.Delete"); + scope.Start(); + try + { + return await RestClient.DeleteAsync(policyDefinitionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation deletes the policy definition in the given subscription with the given name. + /// The name of the policy definition to delete. + /// The cancellation token to use. + public virtual Response Delete(string policyDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.Delete"); + scope.Start(); + try + { + return RestClient.Delete(policyDefinitionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves the policy definition in the given subscription with the given name. + /// The name of the policy definition to get. + /// The cancellation token to use. + public virtual async Task> GetAsync(string policyDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(policyDefinitionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves the policy definition in the given subscription with the given name. + /// The name of the policy definition to get. + /// The cancellation token to use. + public virtual Response Get(string policyDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.Get"); + scope.Start(); + try + { + return RestClient.Get(policyDefinitionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves the built-in policy definition with the given name. + /// The name of the built-in policy definition to get. + /// The cancellation token to use. + public virtual async Task> GetBuiltInAsync(string policyDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.GetBuiltIn"); + scope.Start(); + try + { + return await RestClient.GetBuiltInAsync(policyDefinitionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves the built-in policy definition with the given name. + /// The name of the built-in policy definition to get. + /// The cancellation token to use. + public virtual Response GetBuiltIn(string policyDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.GetBuiltIn"); + scope.Start(); + try + { + return RestClient.GetBuiltIn(policyDefinitionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation creates or updates a policy definition in the given management group with the given name. + /// The name of the policy definition to create. + /// The ID of the management group. + /// The policy definition properties. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAtManagementGroupAsync(string policyDefinitionName, string managementGroupId, PolicyDefinition parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.CreateOrUpdateAtManagementGroup"); + scope.Start(); + try + { + return await RestClient.CreateOrUpdateAtManagementGroupAsync(policyDefinitionName, managementGroupId, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation creates or updates a policy definition in the given management group with the given name. + /// The name of the policy definition to create. + /// The ID of the management group. + /// The policy definition properties. + /// The cancellation token to use. + public virtual Response CreateOrUpdateAtManagementGroup(string policyDefinitionName, string managementGroupId, PolicyDefinition parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.CreateOrUpdateAtManagementGroup"); + scope.Start(); + try + { + return RestClient.CreateOrUpdateAtManagementGroup(policyDefinitionName, managementGroupId, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation deletes the policy definition in the given management group with the given name. + /// The name of the policy definition to delete. + /// The ID of the management group. + /// The cancellation token to use. + public virtual async Task DeleteAtManagementGroupAsync(string policyDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.DeleteAtManagementGroup"); + scope.Start(); + try + { + return await RestClient.DeleteAtManagementGroupAsync(policyDefinitionName, managementGroupId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation deletes the policy definition in the given management group with the given name. + /// The name of the policy definition to delete. + /// The ID of the management group. + /// The cancellation token to use. + public virtual Response DeleteAtManagementGroup(string policyDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.DeleteAtManagementGroup"); + scope.Start(); + try + { + return RestClient.DeleteAtManagementGroup(policyDefinitionName, managementGroupId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves the policy definition in the given management group with the given name. + /// The name of the policy definition to get. + /// The ID of the management group. + /// The cancellation token to use. + public virtual async Task> GetAtManagementGroupAsync(string policyDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.GetAtManagementGroup"); + scope.Start(); + try + { + return await RestClient.GetAtManagementGroupAsync(policyDefinitionName, managementGroupId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves the policy definition in the given management group with the given name. + /// The name of the policy definition to get. + /// The ID of the management group. + /// The cancellation token to use. + public virtual Response GetAtManagementGroup(string policyDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.GetAtManagementGroup"); + scope.Start(); + try + { + return RestClient.GetAtManagementGroup(policyDefinitionName, managementGroupId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves a list of all the policy definitions in a given subscription. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(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("PolicyDefinitionsClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, 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); + } + + /// This operation retrieves a list of all the policy definitions in a given subscription. + /// The cancellation token to use. + public virtual Pageable List(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.List"); + scope.Start(); + try + { + var response = RestClient.List(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("PolicyDefinitionsClient.List"); + scope.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// This operation retrieves a list of all the built-in policy definitions. + /// The cancellation token to use. + public virtual AsyncPageable ListBuiltInAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.ListBuiltIn"); + scope.Start(); + try + { + var response = await RestClient.ListBuiltInAsync(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("PolicyDefinitionsClient.ListBuiltIn"); + scope.Start(); + try + { + var response = await RestClient.ListBuiltInNextPageAsync(nextLink, 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); + } + + /// This operation retrieves a list of all the built-in policy definitions. + /// The cancellation token to use. + public virtual Pageable ListBuiltIn(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.ListBuiltIn"); + scope.Start(); + try + { + var response = RestClient.ListBuiltIn(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("PolicyDefinitionsClient.ListBuiltIn"); + scope.Start(); + try + { + var response = RestClient.ListBuiltInNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// This operation retrieves a list of all the policy definitions in a given management group. + /// The ID of the management group. + /// The cancellation token to use. + public virtual AsyncPageable ListByManagementGroupAsync(string managementGroupId, CancellationToken cancellationToken = default) + { + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.ListByManagementGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByManagementGroupAsync(managementGroupId, 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("PolicyDefinitionsClient.ListByManagementGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByManagementGroupNextPageAsync(nextLink, managementGroupId, 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); + } + + /// This operation retrieves a list of all the policy definitions in a given management group. + /// The ID of the management group. + /// The cancellation token to use. + public virtual Pageable ListByManagementGroup(string managementGroupId, CancellationToken cancellationToken = default) + { + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PolicyDefinitionsClient.ListByManagementGroup"); + scope.Start(); + try + { + var response = RestClient.ListByManagementGroup(managementGroupId, 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("PolicyDefinitionsClient.ListByManagementGroup"); + scope.Start(); + try + { + var response = RestClient.ListByManagementGroupNextPage(nextLink, managementGroupId, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/PolicyDefinitionsRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/PolicyDefinitionsRestClient.cs new file mode 100644 index 000000000000..0d544532fc6b --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/PolicyDefinitionsRestClient.cs @@ -0,0 +1,1093 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class PolicyDefinitionsRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of PolicyDefinitionsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public PolicyDefinitionsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateCreateOrUpdateRequest(string policyDefinitionName, PolicyDefinition parameters) + { + 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("/providers/Microsoft.Authorization/policyDefinitions/", false); + uri.AppendPath(policyDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// This operation creates or updates a policy definition in the given subscription with the given name. + /// The name of the policy definition to create. + /// The policy definition properties. + /// The cancellation token to use. + public async ValueTask> CreateOrUpdateAsync(string policyDefinitionName, PolicyDefinition parameters, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(policyDefinitionName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + { + PolicyDefinition value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinition.DeserializePolicyDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation creates or updates a policy definition in the given subscription with the given name. + /// The name of the policy definition to create. + /// The policy definition properties. + /// The cancellation token to use. + public Response CreateOrUpdate(string policyDefinitionName, PolicyDefinition parameters, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(policyDefinitionName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + { + PolicyDefinition value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinition.DeserializePolicyDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteRequest(string policyDefinitionName) + { + 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("/providers/Microsoft.Authorization/policyDefinitions/", false); + uri.AppendPath(policyDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation deletes the policy definition in the given subscription with the given name. + /// The name of the policy definition to delete. + /// The cancellation token to use. + public async ValueTask DeleteAsync(string policyDefinitionName, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + + using var message = CreateDeleteRequest(policyDefinitionName); + 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); + } + } + + /// This operation deletes the policy definition in the given subscription with the given name. + /// The name of the policy definition to delete. + /// The cancellation token to use. + public Response Delete(string policyDefinitionName, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + + using var message = CreateDeleteRequest(policyDefinitionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetRequest(string policyDefinitionName) + { + 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.Authorization/policyDefinitions/", false); + uri.AppendPath(policyDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves the policy definition in the given subscription with the given name. + /// The name of the policy definition to get. + /// The cancellation token to use. + public async ValueTask> GetAsync(string policyDefinitionName, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + + using var message = CreateGetRequest(policyDefinitionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinition value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinition.DeserializePolicyDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the policy definition in the given subscription with the given name. + /// The name of the policy definition to get. + /// The cancellation token to use. + public Response Get(string policyDefinitionName, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + + using var message = CreateGetRequest(policyDefinitionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinition value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinition.DeserializePolicyDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetBuiltInRequest(string policyDefinitionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Authorization/policyDefinitions/", false); + uri.AppendPath(policyDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves the built-in policy definition with the given name. + /// The name of the built-in policy definition to get. + /// The cancellation token to use. + public async ValueTask> GetBuiltInAsync(string policyDefinitionName, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + + using var message = CreateGetBuiltInRequest(policyDefinitionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinition value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinition.DeserializePolicyDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the built-in policy definition with the given name. + /// The name of the built-in policy definition to get. + /// The cancellation token to use. + public Response GetBuiltIn(string policyDefinitionName, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + + using var message = CreateGetBuiltInRequest(policyDefinitionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinition value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinition.DeserializePolicyDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateAtManagementGroupRequest(string policyDefinitionName, string managementGroupId, PolicyDefinition parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementgroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Authorization/policyDefinitions/", false); + uri.AppendPath(policyDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// This operation creates or updates a policy definition in the given management group with the given name. + /// The name of the policy definition to create. + /// The ID of the management group. + /// The policy definition properties. + /// The cancellation token to use. + public async ValueTask> CreateOrUpdateAtManagementGroupAsync(string policyDefinitionName, string managementGroupId, PolicyDefinition parameters, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtManagementGroupRequest(policyDefinitionName, managementGroupId, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + { + PolicyDefinition value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinition.DeserializePolicyDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation creates or updates a policy definition in the given management group with the given name. + /// The name of the policy definition to create. + /// The ID of the management group. + /// The policy definition properties. + /// The cancellation token to use. + public Response CreateOrUpdateAtManagementGroup(string policyDefinitionName, string managementGroupId, PolicyDefinition parameters, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtManagementGroupRequest(policyDefinitionName, managementGroupId, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + { + PolicyDefinition value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinition.DeserializePolicyDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteAtManagementGroupRequest(string policyDefinitionName, string managementGroupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementgroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Authorization/policyDefinitions/", false); + uri.AppendPath(policyDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation deletes the policy definition in the given management group with the given name. + /// The name of the policy definition to delete. + /// The ID of the management group. + /// The cancellation token to use. + public async ValueTask DeleteAtManagementGroupAsync(string policyDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateDeleteAtManagementGroupRequest(policyDefinitionName, managementGroupId); + 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); + } + } + + /// This operation deletes the policy definition in the given management group with the given name. + /// The name of the policy definition to delete. + /// The ID of the management group. + /// The cancellation token to use. + public Response DeleteAtManagementGroup(string policyDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateDeleteAtManagementGroupRequest(policyDefinitionName, managementGroupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtManagementGroupRequest(string policyDefinitionName, string managementGroupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementgroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Authorization/policyDefinitions/", false); + uri.AppendPath(policyDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves the policy definition in the given management group with the given name. + /// The name of the policy definition to get. + /// The ID of the management group. + /// The cancellation token to use. + public async ValueTask> GetAtManagementGroupAsync(string policyDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateGetAtManagementGroupRequest(policyDefinitionName, managementGroupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinition value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinition.DeserializePolicyDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the policy definition in the given management group with the given name. + /// The name of the policy definition to get. + /// The ID of the management group. + /// The cancellation token to use. + public Response GetAtManagementGroup(string policyDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + if (policyDefinitionName == null) + { + throw new ArgumentNullException(nameof(policyDefinitionName)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateGetAtManagementGroupRequest(policyDefinitionName, managementGroupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinition value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinition.DeserializePolicyDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListRequest() + { + 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.Authorization/policyDefinitions", false); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves a list of all the policy definitions in a given subscription. + /// The cancellation token to use. + public async ValueTask> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinitionListResult.DeserializePolicyDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves a list of all the policy definitions in a given subscription. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinitionListResult.DeserializePolicyDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListBuiltInRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Authorization/policyDefinitions", false); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves a list of all the built-in policy definitions. + /// The cancellation token to use. + public async ValueTask> ListBuiltInAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListBuiltInRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinitionListResult.DeserializePolicyDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves a list of all the built-in policy definitions. + /// The cancellation token to use. + public Response ListBuiltIn(CancellationToken cancellationToken = default) + { + using var message = CreateListBuiltInRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinitionListResult.DeserializePolicyDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByManagementGroupRequest(string managementGroupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementgroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Authorization/policyDefinitions", false); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves a list of all the policy definitions in a given management group. + /// The ID of the management group. + /// The cancellation token to use. + public async ValueTask> ListByManagementGroupAsync(string managementGroupId, CancellationToken cancellationToken = default) + { + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateListByManagementGroupRequest(managementGroupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinitionListResult.DeserializePolicyDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves a list of all the policy definitions in a given management group. + /// The ID of the management group. + /// The cancellation token to use. + public Response ListByManagementGroup(string managementGroupId, CancellationToken cancellationToken = default) + { + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateListByManagementGroupRequest(managementGroupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinitionListResult.DeserializePolicyDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListNextPageRequest(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; + return message; + } + + /// This operation retrieves a list of all the policy definitions in a given subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + public async ValueTask> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinitionListResult.DeserializePolicyDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves a list of all the policy definitions in a given subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinitionListResult.DeserializePolicyDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListBuiltInNextPageRequest(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; + return message; + } + + /// This operation retrieves a list of all the built-in policy definitions. + /// The URL to the next page of results. + /// The cancellation token to use. + public async ValueTask> ListBuiltInNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListBuiltInNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinitionListResult.DeserializePolicyDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves a list of all the built-in policy definitions. + /// The URL to the next page of results. + /// The cancellation token to use. + public Response ListBuiltInNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListBuiltInNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinitionListResult.DeserializePolicyDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByManagementGroupNextPageRequest(string nextLink, string managementGroupId) + { + 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; + return message; + } + + /// This operation retrieves a list of all the policy definitions in a given management group. + /// The URL to the next page of results. + /// The ID of the management group. + /// The cancellation token to use. + public async ValueTask> ListByManagementGroupNextPageAsync(string nextLink, string managementGroupId, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateListByManagementGroupNextPageRequest(nextLink, managementGroupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinitionListResult.DeserializePolicyDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves a list of all the policy definitions in a given management group. + /// The URL to the next page of results. + /// The ID of the management group. + /// The cancellation token to use. + public Response ListByManagementGroupNextPage(string nextLink, string managementGroupId, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateListByManagementGroupNextPageRequest(nextLink, managementGroupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicyDefinitionListResult.DeserializePolicyDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/PolicySetDefinitionsClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/PolicySetDefinitionsClient.cs new file mode 100644 index 000000000000..a72a98e418c7 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/PolicySetDefinitionsClient.cs @@ -0,0 +1,536 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The PolicySetDefinitions service client. + public partial class PolicySetDefinitionsClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal PolicySetDefinitionsRestClient RestClient { get; } + /// Initializes a new instance of PolicySetDefinitionsClient for mocking. + protected PolicySetDefinitionsClient() + { + } + /// Initializes a new instance of PolicySetDefinitionsClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal PolicySetDefinitionsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new PolicySetDefinitionsRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// This operation creates or updates a policy set definition in the given subscription with the given name. + /// The name of the policy set definition to create. + /// The policy set definition properties. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAsync(string policySetDefinitionName, PolicySetDefinition parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.CreateOrUpdate"); + scope.Start(); + try + { + return await RestClient.CreateOrUpdateAsync(policySetDefinitionName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation creates or updates a policy set definition in the given subscription with the given name. + /// The name of the policy set definition to create. + /// The policy set definition properties. + /// The cancellation token to use. + public virtual Response CreateOrUpdate(string policySetDefinitionName, PolicySetDefinition parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.CreateOrUpdate"); + scope.Start(); + try + { + return RestClient.CreateOrUpdate(policySetDefinitionName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation deletes the policy set definition in the given subscription with the given name. + /// The name of the policy set definition to delete. + /// The cancellation token to use. + public virtual async Task DeleteAsync(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.Delete"); + scope.Start(); + try + { + return await RestClient.DeleteAsync(policySetDefinitionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation deletes the policy set definition in the given subscription with the given name. + /// The name of the policy set definition to delete. + /// The cancellation token to use. + public virtual Response Delete(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.Delete"); + scope.Start(); + try + { + return RestClient.Delete(policySetDefinitionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves the policy set definition in the given subscription with the given name. + /// The name of the policy set definition to get. + /// The cancellation token to use. + public virtual async Task> GetAsync(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(policySetDefinitionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves the policy set definition in the given subscription with the given name. + /// The name of the policy set definition to get. + /// The cancellation token to use. + public virtual Response Get(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.Get"); + scope.Start(); + try + { + return RestClient.Get(policySetDefinitionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves the built-in policy set definition with the given name. + /// The name of the policy set definition to get. + /// The cancellation token to use. + public virtual async Task> GetBuiltInAsync(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.GetBuiltIn"); + scope.Start(); + try + { + return await RestClient.GetBuiltInAsync(policySetDefinitionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves the built-in policy set definition with the given name. + /// The name of the policy set definition to get. + /// The cancellation token to use. + public virtual Response GetBuiltIn(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.GetBuiltIn"); + scope.Start(); + try + { + return RestClient.GetBuiltIn(policySetDefinitionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation creates or updates a policy set definition in the given management group with the given name. + /// The name of the policy set definition to create. + /// The ID of the management group. + /// The policy set definition properties. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAtManagementGroupAsync(string policySetDefinitionName, string managementGroupId, PolicySetDefinition parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.CreateOrUpdateAtManagementGroup"); + scope.Start(); + try + { + return await RestClient.CreateOrUpdateAtManagementGroupAsync(policySetDefinitionName, managementGroupId, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation creates or updates a policy set definition in the given management group with the given name. + /// The name of the policy set definition to create. + /// The ID of the management group. + /// The policy set definition properties. + /// The cancellation token to use. + public virtual Response CreateOrUpdateAtManagementGroup(string policySetDefinitionName, string managementGroupId, PolicySetDefinition parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.CreateOrUpdateAtManagementGroup"); + scope.Start(); + try + { + return RestClient.CreateOrUpdateAtManagementGroup(policySetDefinitionName, managementGroupId, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation deletes the policy set definition in the given management group with the given name. + /// The name of the policy set definition to delete. + /// The ID of the management group. + /// The cancellation token to use. + public virtual async Task DeleteAtManagementGroupAsync(string policySetDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.DeleteAtManagementGroup"); + scope.Start(); + try + { + return await RestClient.DeleteAtManagementGroupAsync(policySetDefinitionName, managementGroupId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation deletes the policy set definition in the given management group with the given name. + /// The name of the policy set definition to delete. + /// The ID of the management group. + /// The cancellation token to use. + public virtual Response DeleteAtManagementGroup(string policySetDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.DeleteAtManagementGroup"); + scope.Start(); + try + { + return RestClient.DeleteAtManagementGroup(policySetDefinitionName, managementGroupId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves the policy set definition in the given management group with the given name. + /// The name of the policy set definition to get. + /// The ID of the management group. + /// The cancellation token to use. + public virtual async Task> GetAtManagementGroupAsync(string policySetDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.GetAtManagementGroup"); + scope.Start(); + try + { + return await RestClient.GetAtManagementGroupAsync(policySetDefinitionName, managementGroupId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves the policy set definition in the given management group with the given name. + /// The name of the policy set definition to get. + /// The ID of the management group. + /// The cancellation token to use. + public virtual Response GetAtManagementGroup(string policySetDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.GetAtManagementGroup"); + scope.Start(); + try + { + return RestClient.GetAtManagementGroup(policySetDefinitionName, managementGroupId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation retrieves a list of all the policy set definitions in the given subscription. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(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("PolicySetDefinitionsClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, 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); + } + + /// This operation retrieves a list of all the policy set definitions in the given subscription. + /// The cancellation token to use. + public virtual Pageable List(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.List"); + scope.Start(); + try + { + var response = RestClient.List(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("PolicySetDefinitionsClient.List"); + scope.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// This operation retrieves a list of all the built-in policy set definitions. + /// The cancellation token to use. + public virtual AsyncPageable ListBuiltInAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.ListBuiltIn"); + scope.Start(); + try + { + var response = await RestClient.ListBuiltInAsync(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("PolicySetDefinitionsClient.ListBuiltIn"); + scope.Start(); + try + { + var response = await RestClient.ListBuiltInNextPageAsync(nextLink, 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); + } + + /// This operation retrieves a list of all the built-in policy set definitions. + /// The cancellation token to use. + public virtual Pageable ListBuiltIn(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.ListBuiltIn"); + scope.Start(); + try + { + var response = RestClient.ListBuiltIn(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("PolicySetDefinitionsClient.ListBuiltIn"); + scope.Start(); + try + { + var response = RestClient.ListBuiltInNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// This operation retrieves a list of all the a policy set definition in the given management group. + /// The ID of the management group. + /// The cancellation token to use. + public virtual AsyncPageable ListByManagementGroupAsync(string managementGroupId, CancellationToken cancellationToken = default) + { + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.ListByManagementGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByManagementGroupAsync(managementGroupId, 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("PolicySetDefinitionsClient.ListByManagementGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByManagementGroupNextPageAsync(nextLink, managementGroupId, 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); + } + + /// This operation retrieves a list of all the a policy set definition in the given management group. + /// The ID of the management group. + /// The cancellation token to use. + public virtual Pageable ListByManagementGroup(string managementGroupId, CancellationToken cancellationToken = default) + { + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsClient.ListByManagementGroup"); + scope.Start(); + try + { + var response = RestClient.ListByManagementGroup(managementGroupId, 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("PolicySetDefinitionsClient.ListByManagementGroup"); + scope.Start(); + try + { + var response = RestClient.ListByManagementGroupNextPage(nextLink, managementGroupId, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/PolicySetDefinitionsRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/PolicySetDefinitionsRestClient.cs new file mode 100644 index 000000000000..7e7c614f48e5 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/PolicySetDefinitionsRestClient.cs @@ -0,0 +1,1097 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class PolicySetDefinitionsRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of PolicySetDefinitionsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public PolicySetDefinitionsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateCreateOrUpdateRequest(string policySetDefinitionName, PolicySetDefinition parameters) + { + 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("/providers/Microsoft.Authorization/policySetDefinitions/", false); + uri.AppendPath(policySetDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// This operation creates or updates a policy set definition in the given subscription with the given name. + /// The name of the policy set definition to create. + /// The policy set definition properties. + /// The cancellation token to use. + public async ValueTask> CreateOrUpdateAsync(string policySetDefinitionName, PolicySetDefinition parameters, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(policySetDefinitionName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicySetDefinition value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinition.DeserializePolicySetDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation creates or updates a policy set definition in the given subscription with the given name. + /// The name of the policy set definition to create. + /// The policy set definition properties. + /// The cancellation token to use. + public Response CreateOrUpdate(string policySetDefinitionName, PolicySetDefinition parameters, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(policySetDefinitionName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicySetDefinition value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinition.DeserializePolicySetDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteRequest(string policySetDefinitionName) + { + 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("/providers/Microsoft.Authorization/policySetDefinitions/", false); + uri.AppendPath(policySetDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation deletes the policy set definition in the given subscription with the given name. + /// The name of the policy set definition to delete. + /// The cancellation token to use. + public async ValueTask DeleteAsync(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + + using var message = CreateDeleteRequest(policySetDefinitionName); + 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); + } + } + + /// This operation deletes the policy set definition in the given subscription with the given name. + /// The name of the policy set definition to delete. + /// The cancellation token to use. + public Response Delete(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + + using var message = CreateDeleteRequest(policySetDefinitionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetRequest(string policySetDefinitionName) + { + 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.Authorization/policySetDefinitions/", false); + uri.AppendPath(policySetDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves the policy set definition in the given subscription with the given name. + /// The name of the policy set definition to get. + /// The cancellation token to use. + public async ValueTask> GetAsync(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + + using var message = CreateGetRequest(policySetDefinitionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinition value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinition.DeserializePolicySetDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the policy set definition in the given subscription with the given name. + /// The name of the policy set definition to get. + /// The cancellation token to use. + public Response Get(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + + using var message = CreateGetRequest(policySetDefinitionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinition value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinition.DeserializePolicySetDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetBuiltInRequest(string policySetDefinitionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Authorization/policySetDefinitions/", false); + uri.AppendPath(policySetDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves the built-in policy set definition with the given name. + /// The name of the policy set definition to get. + /// The cancellation token to use. + public async ValueTask> GetBuiltInAsync(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + + using var message = CreateGetBuiltInRequest(policySetDefinitionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinition value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinition.DeserializePolicySetDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the built-in policy set definition with the given name. + /// The name of the policy set definition to get. + /// The cancellation token to use. + public Response GetBuiltIn(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + + using var message = CreateGetBuiltInRequest(policySetDefinitionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinition value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinition.DeserializePolicySetDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListRequest() + { + 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.Authorization/policySetDefinitions", false); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves a list of all the policy set definitions in the given subscription. + /// The cancellation token to use. + public async ValueTask> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinitionListResult.DeserializePolicySetDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves a list of all the policy set definitions in the given subscription. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinitionListResult.DeserializePolicySetDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListBuiltInRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Authorization/policySetDefinitions", false); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves a list of all the built-in policy set definitions. + /// The cancellation token to use. + public async ValueTask> ListBuiltInAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListBuiltInRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinitionListResult.DeserializePolicySetDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves a list of all the built-in policy set definitions. + /// The cancellation token to use. + public Response ListBuiltIn(CancellationToken cancellationToken = default) + { + using var message = CreateListBuiltInRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinitionListResult.DeserializePolicySetDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateAtManagementGroupRequest(string policySetDefinitionName, string managementGroupId, PolicySetDefinition parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementgroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Authorization/policySetDefinitions/", false); + uri.AppendPath(policySetDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// This operation creates or updates a policy set definition in the given management group with the given name. + /// The name of the policy set definition to create. + /// The ID of the management group. + /// The policy set definition properties. + /// The cancellation token to use. + public async ValueTask> CreateOrUpdateAtManagementGroupAsync(string policySetDefinitionName, string managementGroupId, PolicySetDefinition parameters, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtManagementGroupRequest(policySetDefinitionName, managementGroupId, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicySetDefinition value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinition.DeserializePolicySetDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation creates or updates a policy set definition in the given management group with the given name. + /// The name of the policy set definition to create. + /// The ID of the management group. + /// The policy set definition properties. + /// The cancellation token to use. + public Response CreateOrUpdateAtManagementGroup(string policySetDefinitionName, string managementGroupId, PolicySetDefinition parameters, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtManagementGroupRequest(policySetDefinitionName, managementGroupId, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicySetDefinition value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinition.DeserializePolicySetDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteAtManagementGroupRequest(string policySetDefinitionName, string managementGroupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementgroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Authorization/policySetDefinitions/", false); + uri.AppendPath(policySetDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation deletes the policy set definition in the given management group with the given name. + /// The name of the policy set definition to delete. + /// The ID of the management group. + /// The cancellation token to use. + public async ValueTask DeleteAtManagementGroupAsync(string policySetDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateDeleteAtManagementGroupRequest(policySetDefinitionName, managementGroupId); + 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); + } + } + + /// This operation deletes the policy set definition in the given management group with the given name. + /// The name of the policy set definition to delete. + /// The ID of the management group. + /// The cancellation token to use. + public Response DeleteAtManagementGroup(string policySetDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateDeleteAtManagementGroupRequest(policySetDefinitionName, managementGroupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtManagementGroupRequest(string policySetDefinitionName, string managementGroupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementgroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Authorization/policySetDefinitions/", false); + uri.AppendPath(policySetDefinitionName, true); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves the policy set definition in the given management group with the given name. + /// The name of the policy set definition to get. + /// The ID of the management group. + /// The cancellation token to use. + public async ValueTask> GetAtManagementGroupAsync(string policySetDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateGetAtManagementGroupRequest(policySetDefinitionName, managementGroupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinition value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinition.DeserializePolicySetDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves the policy set definition in the given management group with the given name. + /// The name of the policy set definition to get. + /// The ID of the management group. + /// The cancellation token to use. + public Response GetAtManagementGroup(string policySetDefinitionName, string managementGroupId, CancellationToken cancellationToken = default) + { + if (policySetDefinitionName == null) + { + throw new ArgumentNullException(nameof(policySetDefinitionName)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateGetAtManagementGroupRequest(policySetDefinitionName, managementGroupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinition value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinition.DeserializePolicySetDefinition(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByManagementGroupRequest(string managementGroupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementgroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Authorization/policySetDefinitions", false); + uri.AppendQuery("api-version", "2019-09-01", true); + request.Uri = uri; + return message; + } + + /// This operation retrieves a list of all the a policy set definition in the given management group. + /// The ID of the management group. + /// The cancellation token to use. + public async ValueTask> ListByManagementGroupAsync(string managementGroupId, CancellationToken cancellationToken = default) + { + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateListByManagementGroupRequest(managementGroupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinitionListResult.DeserializePolicySetDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves a list of all the a policy set definition in the given management group. + /// The ID of the management group. + /// The cancellation token to use. + public Response ListByManagementGroup(string managementGroupId, CancellationToken cancellationToken = default) + { + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateListByManagementGroupRequest(managementGroupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinitionListResult.DeserializePolicySetDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListNextPageRequest(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; + return message; + } + + /// This operation retrieves a list of all the policy set definitions in the given subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + public async ValueTask> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinitionListResult.DeserializePolicySetDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves a list of all the policy set definitions in the given subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinitionListResult.DeserializePolicySetDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListBuiltInNextPageRequest(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; + return message; + } + + /// This operation retrieves a list of all the built-in policy set definitions. + /// The URL to the next page of results. + /// The cancellation token to use. + public async ValueTask> ListBuiltInNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListBuiltInNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinitionListResult.DeserializePolicySetDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves a list of all the built-in policy set definitions. + /// The URL to the next page of results. + /// The cancellation token to use. + public Response ListBuiltInNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListBuiltInNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinitionListResult.DeserializePolicySetDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByManagementGroupNextPageRequest(string nextLink, string managementGroupId) + { + 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; + return message; + } + + /// This operation retrieves a list of all the a policy set definition in the given management group. + /// The URL to the next page of results. + /// The ID of the management group. + /// The cancellation token to use. + public async ValueTask> ListByManagementGroupNextPageAsync(string nextLink, string managementGroupId, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateListByManagementGroupNextPageRequest(nextLink, managementGroupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinitionListResult.DeserializePolicySetDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation retrieves a list of all the a policy set definition in the given management group. + /// The URL to the next page of results. + /// The ID of the management group. + /// The cancellation token to use. + public Response ListByManagementGroupNextPage(string nextLink, string managementGroupId, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (managementGroupId == null) + { + throw new ArgumentNullException(nameof(managementGroupId)); + } + + using var message = CreateListByManagementGroupNextPageRequest(nextLink, managementGroupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicySetDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = PolicySetDefinitionListResult.DeserializePolicySetDefinitionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ProvidersClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ProvidersClient.cs new file mode 100644 index 000000000000..123f3967138e --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ProvidersClient.cs @@ -0,0 +1,344 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The Providers service client. + public partial class ProvidersClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ProvidersRestClient RestClient { get; } + /// Initializes a new instance of ProvidersClient for mocking. + protected ProvidersClient() + { + } + /// Initializes a new instance of ProvidersClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal ProvidersClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ProvidersRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Unregisters a subscription from a resource provider. + /// The namespace of the resource provider to unregister. + /// The cancellation token to use. + public virtual async Task> UnregisterAsync(string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ProvidersClient.Unregister"); + scope.Start(); + try + { + return await RestClient.UnregisterAsync(resourceProviderNamespace, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Unregisters a subscription from a resource provider. + /// The namespace of the resource provider to unregister. + /// The cancellation token to use. + public virtual Response Unregister(string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ProvidersClient.Unregister"); + scope.Start(); + try + { + return RestClient.Unregister(resourceProviderNamespace, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Registers a subscription with a resource provider. + /// The namespace of the resource provider to register. + /// The cancellation token to use. + public virtual async Task> RegisterAsync(string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ProvidersClient.Register"); + scope.Start(); + try + { + return await RestClient.RegisterAsync(resourceProviderNamespace, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Registers a subscription with a resource provider. + /// The namespace of the resource provider to register. + /// The cancellation token to use. + public virtual Response Register(string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ProvidersClient.Register"); + scope.Start(); + try + { + return RestClient.Register(resourceProviderNamespace, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the specified resource provider. + /// The namespace of the resource provider. + /// The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ProvidersClient.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceProviderNamespace, expand, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the specified resource provider. + /// The namespace of the resource provider. + /// The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public virtual Response Get(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ProvidersClient.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceProviderNamespace, expand, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the specified resource provider at the tenant level. + /// The namespace of the resource provider. + /// The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public virtual async Task> GetAtTenantScopeAsync(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ProvidersClient.GetAtTenantScope"); + scope.Start(); + try + { + return await RestClient.GetAtTenantScopeAsync(resourceProviderNamespace, expand, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the specified resource provider at the tenant level. + /// The namespace of the resource provider. + /// The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public virtual Response GetAtTenantScope(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ProvidersClient.GetAtTenantScope"); + scope.Start(); + try + { + return RestClient.GetAtTenantScope(resourceProviderNamespace, expand, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets all resource providers for a subscription. + /// The number of results to return. If null is passed returns all deployments. + /// The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(int? top = null, string expand = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ProvidersClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(top, expand, 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("ProvidersClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, top, expand, 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); + } + + /// Gets all resource providers for a subscription. + /// The number of results to return. If null is passed returns all deployments. + /// The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public virtual Pageable List(int? top = null, string expand = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ProvidersClient.List"); + scope.Start(); + try + { + var response = RestClient.List(top, expand, 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("ProvidersClient.List"); + scope.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, top, expand, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all resource providers for the tenant. + /// The number of results to return. If null is passed returns all providers. + /// The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public virtual AsyncPageable ListAtTenantScopeAsync(int? top = null, string expand = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ProvidersClient.ListAtTenantScope"); + scope.Start(); + try + { + var response = await RestClient.ListAtTenantScopeAsync(top, expand, 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("ProvidersClient.ListAtTenantScope"); + scope.Start(); + try + { + var response = await RestClient.ListAtTenantScopeNextPageAsync(nextLink, top, expand, 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); + } + + /// Gets all resource providers for the tenant. + /// The number of results to return. If null is passed returns all providers. + /// The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public virtual Pageable ListAtTenantScope(int? top = null, string expand = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ProvidersClient.ListAtTenantScope"); + scope.Start(); + try + { + var response = RestClient.ListAtTenantScope(top, expand, 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("ProvidersClient.ListAtTenantScope"); + scope.Start(); + try + { + var response = RestClient.ListAtTenantScopeNextPage(nextLink, top, expand, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ProvidersRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ProvidersRestClient.cs new file mode 100644 index 000000000000..ae47374414b5 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ProvidersRestClient.cs @@ -0,0 +1,710 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class ProvidersRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ProvidersRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public ProvidersRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateUnregisterRequest(string resourceProviderNamespace) + { + 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/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/unregister", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Unregisters a subscription from a resource provider. + /// The namespace of the resource provider to unregister. + /// The cancellation token to use. + public async ValueTask> UnregisterAsync(string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + using var message = CreateUnregisterRequest(resourceProviderNamespace); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Provider value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Provider.DeserializeProvider(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Unregisters a subscription from a resource provider. + /// The namespace of the resource provider to unregister. + /// The cancellation token to use. + public Response Unregister(string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + using var message = CreateUnregisterRequest(resourceProviderNamespace); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Provider value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Provider.DeserializeProvider(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateRegisterRequest(string resourceProviderNamespace) + { + 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/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/register", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Registers a subscription with a resource provider. + /// The namespace of the resource provider to register. + /// The cancellation token to use. + public async ValueTask> RegisterAsync(string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + using var message = CreateRegisterRequest(resourceProviderNamespace); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Provider value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Provider.DeserializeProvider(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Registers a subscription with a resource provider. + /// The namespace of the resource provider to register. + /// The cancellation token to use. + public Response Register(string resourceProviderNamespace, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + using var message = CreateRegisterRequest(resourceProviderNamespace); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Provider value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Provider.DeserializeProvider(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListRequest(int? top, string expand) + { + 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", false); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets all resource providers for a subscription. + /// The number of results to return. If null is passed returns all deployments. + /// The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public async ValueTask> ListAsync(int? top = null, string expand = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(top, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProviderListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ProviderListResult.DeserializeProviderListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all resource providers for a subscription. + /// The number of results to return. If null is passed returns all deployments. + /// The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public Response List(int? top = null, string expand = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(top, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProviderListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ProviderListResult.DeserializeProviderListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtTenantScopeRequest(int? top, string expand) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers", false); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets all resource providers for the tenant. + /// The number of results to return. If null is passed returns all providers. + /// The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public async ValueTask> ListAtTenantScopeAsync(int? top = null, string expand = null, CancellationToken cancellationToken = default) + { + using var message = CreateListAtTenantScopeRequest(top, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProviderListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ProviderListResult.DeserializeProviderListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all resource providers for the tenant. + /// The number of results to return. If null is passed returns all providers. + /// The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public Response ListAtTenantScope(int? top = null, string expand = null, CancellationToken cancellationToken = default) + { + using var message = CreateListAtTenantScopeRequest(top, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProviderListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ProviderListResult.DeserializeProviderListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetRequest(string resourceProviderNamespace, string expand) + { + 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/", false); + uri.AppendPath(resourceProviderNamespace, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets the specified resource provider. + /// The namespace of the resource provider. + /// The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public async ValueTask> GetAsync(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + using var message = CreateGetRequest(resourceProviderNamespace, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Provider value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Provider.DeserializeProvider(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the specified resource provider. + /// The namespace of the resource provider. + /// The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public Response Get(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + using var message = CreateGetRequest(resourceProviderNamespace, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Provider value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Provider.DeserializeProvider(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtTenantScopeRequest(string resourceProviderNamespace, string expand) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/", false); + uri.AppendPath(resourceProviderNamespace, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets the specified resource provider at the tenant level. + /// The namespace of the resource provider. + /// The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public async ValueTask> GetAtTenantScopeAsync(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + using var message = CreateGetAtTenantScopeRequest(resourceProviderNamespace, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Provider value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Provider.DeserializeProvider(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the specified resource provider at the tenant level. + /// The namespace of the resource provider. + /// The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public Response GetAtTenantScope(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + + using var message = CreateGetAtTenantScopeRequest(resourceProviderNamespace, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Provider value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Provider.DeserializeProvider(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListNextPageRequest(string nextLink, int? top, string expand) + { + 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; + return message; + } + + /// Gets all resource providers for a subscription. + /// The URL to the next page of results. + /// The number of results to return. If null is passed returns all deployments. + /// The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public async ValueTask> ListNextPageAsync(string nextLink, int? top = null, string expand = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink, top, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProviderListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ProviderListResult.DeserializeProviderListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all resource providers for a subscription. + /// The URL to the next page of results. + /// The number of results to return. If null is passed returns all deployments. + /// The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public Response ListNextPage(string nextLink, int? top = null, string expand = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink, top, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProviderListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ProviderListResult.DeserializeProviderListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtTenantScopeNextPageRequest(string nextLink, int? top, string expand) + { + 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; + return message; + } + + /// Gets all resource providers for the tenant. + /// The URL to the next page of results. + /// The number of results to return. If null is passed returns all providers. + /// The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public async ValueTask> ListAtTenantScopeNextPageAsync(string nextLink, int? top = null, string expand = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListAtTenantScopeNextPageRequest(nextLink, top, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProviderListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ProviderListResult.DeserializeProviderListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all resource providers for the tenant. + /// The URL to the next page of results. + /// The number of results to return. If null is passed returns all providers. + /// The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + public Response ListAtTenantScopeNextPage(string nextLink, int? top = null, string expand = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListAtTenantScopeNextPageRequest(nextLink, top, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProviderListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ProviderListResult.DeserializeProviderListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ResourceGroupsClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourceGroupsClient.cs new file mode 100644 index 000000000000..5614678671b0 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourceGroupsClient.cs @@ -0,0 +1,372 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The ResourceGroups service client. + public partial class ResourceGroupsClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ResourceGroupsRestClient RestClient { get; } + /// Initializes a new instance of ResourceGroupsClient for mocking. + protected ResourceGroupsClient() + { + } + /// Initializes a new instance of ResourceGroupsClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal ResourceGroupsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ResourceGroupsRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Checks whether a resource group exists. + /// The name of the resource group to check. The name is case insensitive. + /// The cancellation token to use. + public virtual async Task CheckExistenceAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.CheckExistence"); + scope.Start(); + try + { + return await RestClient.CheckExistenceAsync(resourceGroupName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Checks whether a resource group exists. + /// The name of the resource group to check. The name is case insensitive. + /// The cancellation token to use. + public virtual Response CheckExistence(string resourceGroupName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.CheckExistence"); + scope.Start(); + try + { + return RestClient.CheckExistence(resourceGroupName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a resource group. + /// The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters. + /// Parameters supplied to the create or update a resource group. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, ResourceGroup parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.CreateOrUpdate"); + scope.Start(); + try + { + return await RestClient.CreateOrUpdateAsync(resourceGroupName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a resource group. + /// The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters. + /// Parameters supplied to the create or update a resource group. + /// The cancellation token to use. + public virtual Response CreateOrUpdate(string resourceGroupName, ResourceGroup parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.CreateOrUpdate"); + scope.Start(); + try + { + return RestClient.CreateOrUpdate(resourceGroupName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a resource group. + /// The name of the resource group to get. The name is case insensitive. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a resource group. + /// The name of the resource group to get. The name is case insensitive. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. + /// The name of the resource group to update. The name is case insensitive. + /// Parameters supplied to update a resource group. + /// The cancellation token to use. + public virtual async Task> UpdateAsync(string resourceGroupName, ResourceGroupPatchable parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.Update"); + scope.Start(); + try + { + return await RestClient.UpdateAsync(resourceGroupName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. + /// The name of the resource group to update. The name is case insensitive. + /// Parameters supplied to update a resource group. + /// The cancellation token to use. + public virtual Response Update(string resourceGroupName, ResourceGroupPatchable parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.Update"); + scope.Start(); + try + { + return RestClient.Update(resourceGroupName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets all the resource groups for a subscription. + /// The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. + /// The number of results to return. If null is passed, returns all resource groups. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(filter, top, 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("ResourceGroupsClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, filter, top, 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); + } + + /// Gets all the resource groups for a subscription. + /// The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. + /// The number of results to return. If null is passed, returns all resource groups. + /// The cancellation token to use. + public virtual Pageable List(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.List"); + scope.Start(); + try + { + var response = RestClient.List(filter, top, 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("ResourceGroupsClient.List"); + scope.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, filter, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + /// The name of the resource group to delete. The name is case insensitive. + /// The cancellation token to use. + public virtual async ValueTask StartDeleteAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, cancellationToken).ConfigureAwait(false); + return new ResourceGroupsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + /// The name of the resource group to delete. The name is case insensitive. + /// The cancellation token to use. + public virtual ResourceGroupsDeleteOperation StartDelete(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, cancellationToken); + return new ResourceGroupsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Captures the specified resource group as a template. + /// The name of the resource group. The name is case insensitive. + /// Parameters for exporting the template. + /// The cancellation token to use. + public virtual async ValueTask StartExportTemplateAsync(string resourceGroupName, ExportTemplateRequest parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.StartExportTemplate"); + scope.Start(); + try + { + var originalResponse = await RestClient.ExportTemplateAsync(resourceGroupName, parameters, cancellationToken).ConfigureAwait(false); + return new ResourceGroupsExportTemplateOperation(_clientDiagnostics, _pipeline, RestClient.CreateExportTemplateRequest(resourceGroupName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Captures the specified resource group as a template. + /// The name of the resource group. The name is case insensitive. + /// Parameters for exporting the template. + /// The cancellation token to use. + public virtual ResourceGroupsExportTemplateOperation StartExportTemplate(string resourceGroupName, ExportTemplateRequest parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourceGroupsClient.StartExportTemplate"); + scope.Start(); + try + { + var originalResponse = RestClient.ExportTemplate(resourceGroupName, parameters, cancellationToken); + return new ResourceGroupsExportTemplateOperation(_clientDiagnostics, _pipeline, RestClient.CreateExportTemplateRequest(resourceGroupName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceGroupsDeleteOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourceGroupsDeleteOperation.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceGroupsDeleteOperation.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/ResourceGroupsDeleteOperation.cs index 9fdb9291f0b8..80a75f19dbc8 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceGroupsDeleteOperation.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourceGroupsDeleteOperation.cs @@ -12,7 +12,7 @@ using Azure.Core; using Azure.Core.Pipeline; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. public partial class ResourceGroupsDeleteOperation : Operation, IOperationSource diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ResourceGroupsExportTemplateOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourceGroupsExportTemplateOperation.cs new file mode 100644 index 000000000000..d50a8a5e8363 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourceGroupsExportTemplateOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Captures the specified resource group as a template. + public partial class ResourceGroupsExportTemplateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ResourceGroupsExportTemplateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ResourceGroupsExportTemplateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ResourceGroupExportResult 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); + + ResourceGroupExportResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return ResourceGroupExportResult.DeserializeResourceGroupExportResult(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return ResourceGroupExportResult.DeserializeResourceGroupExportResult(document.RootElement); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ResourceGroupsRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourceGroupsRestClient.cs new file mode 100644 index 000000000000..433a0b52ef16 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourceGroupsRestClient.cs @@ -0,0 +1,680 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class ResourceGroupsRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ResourceGroupsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public ResourceGroupsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateCheckExistenceRequest(string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Checks whether a resource group exists. + /// The name of the resource group to check. The name is case insensitive. + /// The cancellation token to use. + public async ValueTask CheckExistenceAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateCheckExistenceRequest(resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Checks whether a resource group exists. + /// The name of the resource group to check. The name is case insensitive. + /// The cancellation token to use. + public Response CheckExistence(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateCheckExistenceRequest(resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, ResourceGroup parameters) + { + 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.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Creates or updates a resource group. + /// The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters. + /// Parameters supplied to the create or update a resource group. + /// The cancellation token to use. + public async ValueTask> CreateOrUpdateAsync(string resourceGroupName, ResourceGroup parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ResourceGroup value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceGroup.DeserializeResourceGroup(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates or updates a resource group. + /// The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters. + /// Parameters supplied to the create or update a resource group. + /// The cancellation token to use. + public Response CreateOrUpdate(string resourceGroupName, ResourceGroup parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ResourceGroup value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceGroup.DeserializeResourceGroup(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteRequest(string resourceGroupName) + { + 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.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + /// The name of the resource group to delete. The name is case insensitive. + /// The cancellation token to use. + public async ValueTask DeleteAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateDeleteRequest(resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + /// The name of the resource group to delete. The name is case insensitive. + /// The cancellation token to use. + public Response Delete(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateDeleteRequest(resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetRequest(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.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets a resource group. + /// The name of the resource group to get. The name is case insensitive. + /// The cancellation token to use. + public async ValueTask> GetAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateGetRequest(resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceGroup value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceGroup.DeserializeResourceGroup(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a resource group. + /// The name of the resource group to get. The name is case insensitive. + /// The cancellation token to use. + public Response Get(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateGetRequest(resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceGroup value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceGroup.DeserializeResourceGroup(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateUpdateRequest(string resourceGroupName, ResourceGroupPatchable parameters) + { + 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.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. + /// The name of the resource group to update. The name is case insensitive. + /// Parameters supplied to update a resource group. + /// The cancellation token to use. + public async ValueTask> UpdateAsync(string resourceGroupName, ResourceGroupPatchable parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceGroup value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceGroup.DeserializeResourceGroup(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. + /// The name of the resource group to update. The name is case insensitive. + /// Parameters supplied to update a resource group. + /// The cancellation token to use. + public Response Update(string resourceGroupName, ResourceGroupPatchable parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceGroup value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceGroup.DeserializeResourceGroup(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateExportTemplateRequest(string resourceGroupName, ExportTemplateRequest parameters) + { + 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("/exportTemplate", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Captures the specified resource group as a template. + /// The name of the resource group. The name is case insensitive. + /// Parameters for exporting the template. + /// The cancellation token to use. + public async ValueTask ExportTemplateAsync(string resourceGroupName, ExportTemplateRequest parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateExportTemplateRequest(resourceGroupName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Captures the specified resource group as a template. + /// The name of the resource group. The name is case insensitive. + /// Parameters for exporting the template. + /// The cancellation token to use. + public Response ExportTemplate(string resourceGroupName, ExportTemplateRequest parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateExportTemplateRequest(resourceGroupName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListRequest(string filter, int? top) + { + 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); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets all the resource groups for a subscription. + /// The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. + /// The number of results to return. If null is passed, returns all resource groups. + /// The cancellation token to use. + public async ValueTask> ListAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceGroupListResult.DeserializeResourceGroupListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the resource groups for a subscription. + /// The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. + /// The number of results to return. If null is passed, returns all resource groups. + /// The cancellation token to use. + public Response List(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceGroupListResult.DeserializeResourceGroupListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListNextPageRequest(string nextLink, string filter, int? top) + { + 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; + return message; + } + + /// Gets all the resource groups for a subscription. + /// The URL to the next page of results. + /// The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. + /// The number of results to return. If null is passed, returns all resource groups. + /// The cancellation token to use. + public async ValueTask> ListNextPageAsync(string nextLink, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceGroupListResult.DeserializeResourceGroupListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the resource groups for a subscription. + /// The URL to the next page of results. + /// The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. + /// The number of results to return. If null is passed, returns all resource groups. + /// The cancellation token to use. + public Response ListNextPage(string nextLink, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceGroupListResult.DeserializeResourceGroupListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ResourceLinksClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourceLinksClient.cs new file mode 100644 index 000000000000..47be97a52da3 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourceLinksClient.cs @@ -0,0 +1,312 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The ResourceLinks service client. + public partial class ResourceLinksClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ResourceLinksRestClient RestClient { get; } + /// Initializes a new instance of ResourceLinksClient for mocking. + protected ResourceLinksClient() + { + } + /// Initializes a new instance of ResourceLinksClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal ResourceLinksClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ResourceLinksRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Deletes a resource link with the specified ID. + /// The fully qualified ID of the resource link. Use the format, /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. + /// The cancellation token to use. + public virtual async Task DeleteAsync(string linkId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceLinksClient.Delete"); + scope.Start(); + try + { + return await RestClient.DeleteAsync(linkId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a resource link with the specified ID. + /// The fully qualified ID of the resource link. Use the format, /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. + /// The cancellation token to use. + public virtual Response Delete(string linkId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceLinksClient.Delete"); + scope.Start(); + try + { + return RestClient.Delete(linkId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a resource link between the specified resources. + /// The fully qualified ID of the resource link. Use the format, /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. + /// Parameters for creating or updating a resource link. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAsync(string linkId, ResourceLink parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceLinksClient.CreateOrUpdate"); + scope.Start(); + try + { + return await RestClient.CreateOrUpdateAsync(linkId, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a resource link between the specified resources. + /// The fully qualified ID of the resource link. Use the format, /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. + /// Parameters for creating or updating a resource link. + /// The cancellation token to use. + public virtual Response CreateOrUpdate(string linkId, ResourceLink parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceLinksClient.CreateOrUpdate"); + scope.Start(); + try + { + return RestClient.CreateOrUpdate(linkId, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a resource link with the specified ID. + /// The fully qualified Id of the resource link. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. + /// The cancellation token to use. + public virtual async Task> GetAsync(string linkId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceLinksClient.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(linkId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a resource link with the specified ID. + /// The fully qualified Id of the resource link. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. + /// The cancellation token to use. + public virtual Response Get(string linkId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourceLinksClient.Get"); + scope.Start(); + try + { + return RestClient.Get(linkId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets all the linked resources for the subscription. + /// The filter to apply on the list resource links operation. The supported filter for list resource links is targetId. For example, $filter=targetId eq {value}. + /// The cancellation token to use. + public virtual AsyncPageable ListAtSubscriptionAsync(string filter = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ResourceLinksClient.ListAtSubscription"); + scope.Start(); + try + { + var response = await RestClient.ListAtSubscriptionAsync(filter, 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("ResourceLinksClient.ListAtSubscription"); + scope.Start(); + try + { + var response = await RestClient.ListAtSubscriptionNextPageAsync(nextLink, filter, 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); + } + + /// Gets all the linked resources for the subscription. + /// The filter to apply on the list resource links operation. The supported filter for list resource links is targetId. For example, $filter=targetId eq {value}. + /// The cancellation token to use. + public virtual Pageable ListAtSubscription(string filter = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ResourceLinksClient.ListAtSubscription"); + scope.Start(); + try + { + var response = RestClient.ListAtSubscription(filter, 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("ResourceLinksClient.ListAtSubscription"); + scope.Start(); + try + { + var response = RestClient.ListAtSubscriptionNextPage(nextLink, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a list of resource links at and below the specified source scope. + /// The fully qualified ID of the scope for getting the resource links. For example, to list resource links at and under a resource group, set the scope to /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup. + /// The cancellation token to use. + public virtual AsyncPageable ListAtSourceScopeAsync(string scope, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ResourceLinksClient.ListAtSourceScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtSourceScopeAsync(scope, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ResourceLinksClient.ListAtSourceScope"); + scope0.Start(); + try + { + var response = await RestClient.ListAtSourceScopeNextPageAsync(nextLink, scope, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a list of resource links at and below the specified source scope. + /// The fully qualified ID of the scope for getting the resource links. For example, to list resource links at and under a resource group, set the scope to /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup. + /// The cancellation token to use. + public virtual Pageable ListAtSourceScope(string scope, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ResourceLinksClient.ListAtSourceScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtSourceScope(scope, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("ResourceLinksClient.ListAtSourceScope"); + scope0.Start(); + try + { + var response = RestClient.ListAtSourceScopeNextPage(nextLink, scope, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ResourceLinksRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourceLinksRestClient.cs new file mode 100644 index 000000000000..baa26d4eb5a2 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourceLinksRestClient.cs @@ -0,0 +1,605 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class ResourceLinksRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ResourceLinksRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public ResourceLinksRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateDeleteRequest(string linkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(linkId, false); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Deletes a resource link with the specified ID. + /// The fully qualified ID of the resource link. Use the format, /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. + /// The cancellation token to use. + public async ValueTask DeleteAsync(string linkId, CancellationToken cancellationToken = default) + { + if (linkId == null) + { + throw new ArgumentNullException(nameof(linkId)); + } + + using var message = CreateDeleteRequest(linkId); + 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); + } + } + + /// Deletes a resource link with the specified ID. + /// The fully qualified ID of the resource link. Use the format, /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. + /// The cancellation token to use. + public Response Delete(string linkId, CancellationToken cancellationToken = default) + { + if (linkId == null) + { + throw new ArgumentNullException(nameof(linkId)); + } + + using var message = CreateDeleteRequest(linkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateRequest(string linkId, ResourceLink parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(linkId, false); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Creates or updates a resource link between the specified resources. + /// The fully qualified ID of the resource link. Use the format, /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. + /// Parameters for creating or updating a resource link. + /// The cancellation token to use. + public async ValueTask> CreateOrUpdateAsync(string linkId, ResourceLink parameters, CancellationToken cancellationToken = default) + { + if (linkId == null) + { + throw new ArgumentNullException(nameof(linkId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(linkId, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ResourceLink value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceLink.DeserializeResourceLink(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates or updates a resource link between the specified resources. + /// The fully qualified ID of the resource link. Use the format, /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. + /// Parameters for creating or updating a resource link. + /// The cancellation token to use. + public Response CreateOrUpdate(string linkId, ResourceLink parameters, CancellationToken cancellationToken = default) + { + if (linkId == null) + { + throw new ArgumentNullException(nameof(linkId)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(linkId, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ResourceLink value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceLink.DeserializeResourceLink(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetRequest(string linkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(linkId, false); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Gets a resource link with the specified ID. + /// The fully qualified Id of the resource link. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. + /// The cancellation token to use. + public async ValueTask> GetAsync(string linkId, CancellationToken cancellationToken = default) + { + if (linkId == null) + { + throw new ArgumentNullException(nameof(linkId)); + } + + using var message = CreateGetRequest(linkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceLink value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceLink.DeserializeResourceLink(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a resource link with the specified ID. + /// The fully qualified Id of the resource link. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. + /// The cancellation token to use. + public Response Get(string linkId, CancellationToken cancellationToken = default) + { + if (linkId == null) + { + throw new ArgumentNullException(nameof(linkId)); + } + + using var message = CreateGetRequest(linkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceLink value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceLink.DeserializeResourceLink(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtSubscriptionRequest(string filter) + { + 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.Resources/links", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Gets all the linked resources for the subscription. + /// The filter to apply on the list resource links operation. The supported filter for list resource links is targetId. For example, $filter=targetId eq {value}. + /// The cancellation token to use. + public async ValueTask> ListAtSubscriptionAsync(string filter = null, CancellationToken cancellationToken = default) + { + using var message = CreateListAtSubscriptionRequest(filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceLinkResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the linked resources for the subscription. + /// The filter to apply on the list resource links operation. The supported filter for list resource links is targetId. For example, $filter=targetId eq {value}. + /// The cancellation token to use. + public Response ListAtSubscription(string filter = null, CancellationToken cancellationToken = default) + { + using var message = CreateListAtSubscriptionRequest(filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceLinkResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtSourceScopeRequest(string scope) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/links", false); + uri.AppendQuery("$filter", "atScope()", true); + uri.AppendQuery("api-version", "2016-09-01", true); + request.Uri = uri; + return message; + } + + /// Gets a list of resource links at and below the specified source scope. + /// The fully qualified ID of the scope for getting the resource links. For example, to list resource links at and under a resource group, set the scope to /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup. + /// The cancellation token to use. + public async ValueTask> ListAtSourceScopeAsync(string scope, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateListAtSourceScopeRequest(scope); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceLinkResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of resource links at and below the specified source scope. + /// The fully qualified ID of the scope for getting the resource links. For example, to list resource links at and under a resource group, set the scope to /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup. + /// The cancellation token to use. + public Response ListAtSourceScope(string scope, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateListAtSourceScopeRequest(scope); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceLinkResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtSubscriptionNextPageRequest(string nextLink, string filter) + { + 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; + return message; + } + + /// Gets all the linked resources for the subscription. + /// The URL to the next page of results. + /// The filter to apply on the list resource links operation. The supported filter for list resource links is targetId. For example, $filter=targetId eq {value}. + /// The cancellation token to use. + public async ValueTask> ListAtSubscriptionNextPageAsync(string nextLink, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListAtSubscriptionNextPageRequest(nextLink, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceLinkResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all the linked resources for the subscription. + /// The URL to the next page of results. + /// The filter to apply on the list resource links operation. The supported filter for list resource links is targetId. For example, $filter=targetId eq {value}. + /// The cancellation token to use. + public Response ListAtSubscriptionNextPage(string nextLink, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListAtSubscriptionNextPageRequest(nextLink, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceLinkResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListAtSourceScopeNextPageRequest(string nextLink, string scope) + { + 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; + return message; + } + + /// Gets a list of resource links at and below the specified source scope. + /// The URL to the next page of results. + /// The fully qualified ID of the scope for getting the resource links. For example, to list resource links at and under a resource group, set the scope to /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup. + /// The cancellation token to use. + public async ValueTask> ListAtSourceScopeNextPageAsync(string nextLink, string scope, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateListAtSourceScopeNextPageRequest(nextLink, scope); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceLinkResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of resource links at and below the specified source scope. + /// The URL to the next page of results. + /// The fully qualified ID of the scope for getting the resource links. For example, to list resource links at and under a resource group, set the scope to /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup. + /// The cancellation token to use. + public Response ListAtSourceScopeNextPage(string nextLink, string scope, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateListAtSourceScopeNextPageRequest(nextLink, scope); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceLinkResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesClient.cs new file mode 100644 index 000000000000..33176b55a4f7 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesClient.cs @@ -0,0 +1,1004 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The Resources service client. + public partial class ResourcesClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ResourcesRestClient RestClient { get; } + /// Initializes a new instance of ResourcesClient for mocking. + protected ResourcesClient() + { + } + /// Initializes a new instance of ResourcesClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal ResourcesClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ResourcesRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Checks whether a resource exists. + /// The name of the resource group containing the resource to check. The name is case insensitive. + /// The resource provider of the resource to check. + /// The parent resource identity. + /// The resource type. + /// The name of the resource to check whether it exists. + /// The API version to use for the operation. + /// The cancellation token to use. + public virtual async Task CheckExistenceAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.CheckExistence"); + scope.Start(); + try + { + return await RestClient.CheckExistenceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Checks whether a resource exists. + /// The name of the resource group containing the resource to check. The name is case insensitive. + /// The resource provider of the resource to check. + /// The parent resource identity. + /// The resource type. + /// The name of the resource to check whether it exists. + /// The API version to use for the operation. + /// The cancellation token to use. + public virtual Response CheckExistence(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.CheckExistence"); + scope.Start(); + try + { + return RestClient.CheckExistence(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a resource. + /// The name of the resource group containing the resource to get. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource. + /// The name of the resource to get. + /// The API version to use for the operation. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a resource. + /// The name of the resource group containing the resource to get. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource. + /// The name of the resource to get. + /// The API version to use for the operation. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Checks by ID whether a resource exists. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// The cancellation token to use. + public virtual async Task CheckExistenceByIdAsync(string resourceId, string apiVersion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.CheckExistenceById"); + scope.Start(); + try + { + return await RestClient.CheckExistenceByIdAsync(resourceId, apiVersion, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Checks by ID whether a resource exists. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// The cancellation token to use. + public virtual Response CheckExistenceById(string resourceId, string apiVersion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.CheckExistenceById"); + scope.Start(); + try + { + return RestClient.CheckExistenceById(resourceId, apiVersion, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// The cancellation token to use. + public virtual async Task> GetByIdAsync(string resourceId, string apiVersion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.GetById"); + scope.Start(); + try + { + return await RestClient.GetByIdAsync(resourceId, apiVersion, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// The cancellation token to use. + public virtual Response GetById(string resourceId, string apiVersion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.GetById"); + scope.Start(); + try + { + return RestClient.GetById(resourceId, apiVersion, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get all the resources for a resource group. + /// The resource group with the resources to get. + /// The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + /// The number of results to return. If null is passed, returns all resources. + /// The cancellation token to use. + public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, filter, expand, top, 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("ResourcesClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, filter, expand, top, 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 all the resources for a resource group. + /// The resource group with the resources to get. + /// The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + /// The number of results to return. If null is passed, returns all resources. + /// The cancellation token to use. + public virtual Pageable ListByResourceGroup(string resourceGroupName, string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = RestClient.ListByResourceGroup(resourceGroupName, filter, expand, top, 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("ResourcesClient.ListByResourceGroup"); + scope.Start(); + try + { + var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, filter, expand, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Get all the resources in a subscription. + /// The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + /// The number of results to return. If null is passed, returns all resource groups. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(filter, expand, top, 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("ResourcesClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, filter, expand, top, 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 all the resources in a subscription. + /// The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + /// The number of results to return. If null is passed, returns all resource groups. + /// The cancellation token to use. + public virtual Pageable List(string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.List"); + scope.Start(); + try + { + var response = RestClient.List(filter, expand, top, 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("ResourcesClient.List"); + scope.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, filter, expand, top, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + /// The name of the resource group containing the resources to move. + /// Parameters for moving resources. + /// The cancellation token to use. + public virtual async ValueTask StartMoveResourcesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken = default) + { + if (sourceResourceGroupName == null) + { + throw new ArgumentNullException(nameof(sourceResourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartMoveResources"); + scope.Start(); + try + { + var originalResponse = await RestClient.MoveResourcesAsync(sourceResourceGroupName, parameters, cancellationToken).ConfigureAwait(false); + return new ResourcesMoveResourcesOperation(_clientDiagnostics, _pipeline, RestClient.CreateMoveResourcesRequest(sourceResourceGroupName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + /// The name of the resource group containing the resources to move. + /// Parameters for moving resources. + /// The cancellation token to use. + public virtual ResourcesMoveResourcesOperation StartMoveResources(string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken = default) + { + if (sourceResourceGroupName == null) + { + throw new ArgumentNullException(nameof(sourceResourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartMoveResources"); + scope.Start(); + try + { + var originalResponse = RestClient.MoveResources(sourceResourceGroupName, parameters, cancellationToken); + return new ResourcesMoveResourcesOperation(_clientDiagnostics, _pipeline, RestClient.CreateMoveResourcesRequest(sourceResourceGroupName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + /// The name of the resource group containing the resources to validate for move. + /// Parameters for moving resources. + /// The cancellation token to use. + public virtual async ValueTask StartValidateMoveResourcesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken = default) + { + if (sourceResourceGroupName == null) + { + throw new ArgumentNullException(nameof(sourceResourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartValidateMoveResources"); + scope.Start(); + try + { + var originalResponse = await RestClient.ValidateMoveResourcesAsync(sourceResourceGroupName, parameters, cancellationToken).ConfigureAwait(false); + return new ResourcesValidateMoveResourcesOperation(_clientDiagnostics, _pipeline, RestClient.CreateValidateMoveResourcesRequest(sourceResourceGroupName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + /// The name of the resource group containing the resources to validate for move. + /// Parameters for moving resources. + /// The cancellation token to use. + public virtual ResourcesValidateMoveResourcesOperation StartValidateMoveResources(string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken = default) + { + if (sourceResourceGroupName == null) + { + throw new ArgumentNullException(nameof(sourceResourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartValidateMoveResources"); + scope.Start(); + try + { + var originalResponse = RestClient.ValidateMoveResources(sourceResourceGroupName, parameters, cancellationToken); + return new ResourcesValidateMoveResourcesOperation(_clientDiagnostics, _pipeline, RestClient.CreateValidateMoveResourcesRequest(sourceResourceGroupName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a resource. + /// The name of the resource group that contains the resource to delete. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type. + /// The name of the resource to delete. + /// The API version to use for the operation. + /// The cancellation token to use. + public virtual async ValueTask StartDeleteAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, cancellationToken).ConfigureAwait(false); + return new ResourcesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a resource. + /// The name of the resource group that contains the resource to delete. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type. + /// The name of the resource to delete. + /// The API version to use for the operation. + /// The cancellation token to use. + public virtual ResourcesDeleteOperation StartDelete(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, cancellationToken); + return new ResourcesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a resource. + /// The name of the resource group for the resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource to create. + /// The name of the resource to create. + /// The API version to use for the operation. + /// Parameters for creating or updating the resource. + /// The cancellation token to use. + public virtual async ValueTask StartCreateOrUpdateAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, cancellationToken).ConfigureAwait(false); + return new ResourcesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a resource. + /// The name of the resource group for the resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource to create. + /// The name of the resource to create. + /// The API version to use for the operation. + /// Parameters for creating or updating the resource. + /// The cancellation token to use. + public virtual ResourcesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, cancellationToken); + return new ResourcesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates a resource. + /// The name of the resource group for the resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource to update. + /// The name of the resource to update. + /// The API version to use for the operation. + /// Parameters for updating the resource. + /// The cancellation token to use. + public virtual async ValueTask StartUpdateAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, cancellationToken).ConfigureAwait(false); + return new ResourcesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates a resource. + /// The name of the resource group for the resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource to update. + /// The name of the resource to update. + /// The API version to use for the operation. + /// Parameters for updating the resource. + /// The cancellation token to use. + public virtual ResourcesUpdateOperation StartUpdate(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.Update(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, cancellationToken); + return new ResourcesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// The cancellation token to use. + public virtual async ValueTask StartDeleteByIdAsync(string resourceId, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartDeleteById"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteByIdAsync(resourceId, apiVersion, cancellationToken).ConfigureAwait(false); + return new ResourcesDeleteByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteByIdRequest(resourceId, apiVersion).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// The cancellation token to use. + public virtual ResourcesDeleteByIdOperation StartDeleteById(string resourceId, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartDeleteById"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteById(resourceId, apiVersion, cancellationToken); + return new ResourcesDeleteByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteByIdRequest(resourceId, apiVersion).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// Create or update resource parameters. + /// The cancellation token to use. + public virtual async ValueTask StartCreateOrUpdateByIdAsync(string resourceId, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartCreateOrUpdateById"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateByIdAsync(resourceId, apiVersion, parameters, cancellationToken).ConfigureAwait(false); + return new ResourcesCreateOrUpdateByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateByIdRequest(resourceId, apiVersion, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// Create or update resource parameters. + /// The cancellation token to use. + public virtual ResourcesCreateOrUpdateByIdOperation StartCreateOrUpdateById(string resourceId, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartCreateOrUpdateById"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdateById(resourceId, apiVersion, parameters, cancellationToken); + return new ResourcesCreateOrUpdateByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateByIdRequest(resourceId, apiVersion, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// Update resource parameters. + /// The cancellation token to use. + public virtual async ValueTask StartUpdateByIdAsync(string resourceId, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartUpdateById"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateByIdAsync(resourceId, apiVersion, parameters, cancellationToken).ConfigureAwait(false); + return new ResourcesUpdateByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateByIdRequest(resourceId, apiVersion, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// Update resource parameters. + /// The cancellation token to use. + public virtual ResourcesUpdateByIdOperation StartUpdateById(string resourceId, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ResourcesClient.StartUpdateById"); + scope.Start(); + try + { + var originalResponse = RestClient.UpdateById(resourceId, apiVersion, parameters, cancellationToken); + return new ResourcesUpdateByIdOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateByIdRequest(resourceId, apiVersion, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesCreateOrUpdateByIdOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesCreateOrUpdateByIdOperation.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesCreateOrUpdateByIdOperation.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/ResourcesCreateOrUpdateByIdOperation.cs index 2fba020a20c5..2f64432d7737 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesCreateOrUpdateByIdOperation.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesCreateOrUpdateByIdOperation.cs @@ -12,9 +12,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// Create a resource by ID. public partial class ResourcesCreateOrUpdateByIdOperation : Operation, IOperationSource diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesCreateOrUpdateOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesCreateOrUpdateOperation.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesCreateOrUpdateOperation.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/ResourcesCreateOrUpdateOperation.cs index 7a7d7e0d347a..70e657082873 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesCreateOrUpdateOperation.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesCreateOrUpdateOperation.cs @@ -12,9 +12,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// Creates a resource. public partial class ResourcesCreateOrUpdateOperation : Operation, IOperationSource diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesDeleteByIdOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesDeleteByIdOperation.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesDeleteByIdOperation.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/ResourcesDeleteByIdOperation.cs index 8720cc72adac..6b2071327c9a 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesDeleteByIdOperation.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesDeleteByIdOperation.cs @@ -12,7 +12,7 @@ using Azure.Core; using Azure.Core.Pipeline; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// Deletes a resource by ID. public partial class ResourcesDeleteByIdOperation : Operation, IOperationSource diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesDeleteOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesDeleteOperation.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesDeleteOperation.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/ResourcesDeleteOperation.cs index 92a077f630a8..9164e13e8c81 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesDeleteOperation.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesDeleteOperation.cs @@ -12,7 +12,7 @@ using Azure.Core; using Azure.Core.Pipeline; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// Deletes a resource. public partial class ResourcesDeleteOperation : Operation, IOperationSource diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesManagementClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesManagementClient.cs new file mode 100644 index 000000000000..6286e13f6139 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesManagementClient.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Management.Resources; + +namespace Azure.Management.Resources +{ + /// Resources service management client. + public class ResourcesManagementClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _subscriptionId; + + /// Initializes a new instance of ResourcesManagementClient for mocking. + protected ResourcesManagementClient() + { + } + + /// Initializes a new instance of ResourcesManagementClient. + /// The ID of the target subscription. + /// The OAuth token for making client requests. + /// The options for configuring the client. + public ResourcesManagementClient(string subscriptionId, TokenCredential tokenCredential, ResourcesManagementClientOptions options = null) : this(null, subscriptionId, tokenCredential, options) + { + } + /// Initializes a new instance of ResourcesManagementClient. + /// server parameter. + /// The ID of the target subscription. + /// The OAuth token for making client requests. + /// The options for configuring the client. + /// This occurs when one of the required arguments is null. + public ResourcesManagementClient(Uri endpoint, string subscriptionId, TokenCredential tokenCredential, ResourcesManagementClientOptions options = null) + { + endpoint ??= new Uri("https://management.azure.com"); + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + + options ??= new ResourcesManagementClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _pipeline = ManagementPipelineBuilder.Build(tokenCredential, endpoint, options); + _endpoint = endpoint; + _subscriptionId = subscriptionId; + } + + /// Creates a new instance of OperationsClient. + public virtual OperationsClient GetOperationsClient() + { + return new OperationsClient(_clientDiagnostics, _pipeline, _endpoint); + } + + /// Creates a new instance of DeploymentsClient. + public virtual DeploymentsClient GetDeploymentsClient() + { + return new DeploymentsClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of ProvidersClient. + public virtual ProvidersClient GetProvidersClient() + { + return new ProvidersClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of ResourcesClient. + public virtual ResourcesClient GetResourcesClient() + { + return new ResourcesClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of ResourceGroupsClient. + public virtual ResourceGroupsClient GetResourceGroupsClient() + { + return new ResourceGroupsClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of TagsClient. + public virtual TagsClient GetTagsClient() + { + return new TagsClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of DeploymentClient. + public virtual DeploymentClient GetDeploymentClient() + { + return new DeploymentClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of SubscriptionsClient. + public virtual SubscriptionsClient GetSubscriptionsClient() + { + return new SubscriptionsClient(_clientDiagnostics, _pipeline, _endpoint); + } + + /// Creates a new instance of TenantsClient. + public virtual TenantsClient GetTenantsClient() + { + return new TenantsClient(_clientDiagnostics, _pipeline, _endpoint); + } + + /// Creates a new instance of PolicyAssignmentsClient. + public virtual PolicyAssignmentsClient GetPolicyAssignmentsClient() + { + return new PolicyAssignmentsClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of PolicyDefinitionsClient. + public virtual PolicyDefinitionsClient GetPolicyDefinitionsClient() + { + return new PolicyDefinitionsClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of PolicySetDefinitionsClient. + public virtual PolicySetDefinitionsClient GetPolicySetDefinitionsClient() + { + return new PolicySetDefinitionsClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of DeploymentScriptsClient. + public virtual DeploymentScriptsClient GetDeploymentScriptsClient() + { + return new DeploymentScriptsClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of ServiceClient. + public virtual ServiceClient GetServiceClient() + { + return new ServiceClient(_clientDiagnostics, _pipeline, _endpoint); + } + + /// Creates a new instance of FeaturesClient. + public virtual FeaturesClient GetFeaturesClient() + { + return new FeaturesClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of AuthorizationClient. + public virtual AuthorizationClient GetAuthorizationClient() + { + return new AuthorizationClient(_clientDiagnostics, _pipeline, _endpoint); + } + + /// Creates a new instance of ManagementLocksClient. + public virtual ManagementLocksClient GetManagementLocksClient() + { + return new ManagementLocksClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of ResourceLinksClient. + public virtual ResourceLinksClient GetResourceLinksClient() + { + return new ResourceLinksClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of ApplicationsClient. + public virtual ApplicationsClient GetApplicationsClient() + { + return new ApplicationsClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + + /// Creates a new instance of ApplicationDefinitionsClient. + public virtual ApplicationDefinitionsClient GetApplicationDefinitionsClient() + { + return new ApplicationDefinitionsClient(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceManagementClientOptions.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesManagementClientOptions.cs similarity index 51% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceManagementClientOptions.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/ResourcesManagementClientOptions.cs index 41ef9bfeddf5..f2e2054e49fa 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceManagementClientOptions.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesManagementClientOptions.cs @@ -7,10 +7,10 @@ using Azure.Core; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { - /// Client options for Resource. - public class ResourceManagementClientOptions : ClientOptions + /// Client options for Resources. + public class ResourcesManagementClientOptions : ClientOptions { } } diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesMoveResourcesOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesMoveResourcesOperation.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesMoveResourcesOperation.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/ResourcesMoveResourcesOperation.cs index 202676a5971b..e0bc9f2a4555 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesMoveResourcesOperation.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesMoveResourcesOperation.cs @@ -12,7 +12,7 @@ using Azure.Core; using Azure.Core.Pipeline; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. public partial class ResourcesMoveResourcesOperation : Operation, IOperationSource diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesRestClient.cs new file mode 100644 index 000000000000..0d7a4f95af12 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesRestClient.cs @@ -0,0 +1,1592 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class ResourcesRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ResourcesRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public ResourcesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateListByResourceGroupRequest(string resourceGroupName, string filter, string expand, int? top) + { + 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("/resources", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Get all the resources for a resource group. + /// The resource group with the resources to get. + /// The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + /// The number of results to return. If null is passed, returns all resources. + /// The cancellation token to use. + public async ValueTask> ListByResourceGroupAsync(string resourceGroupName, string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupRequest(resourceGroupName, filter, expand, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the resources for a resource group. + /// The resource group with the resources to get. + /// The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + /// The number of results to return. If null is passed, returns all resources. + /// The cancellation token to use. + public Response ListByResourceGroup(string resourceGroupName, string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupRequest(resourceGroupName, filter, expand, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateMoveResourcesRequest(string sourceResourceGroupName, ResourcesMoveInfo parameters) + { + 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(sourceResourceGroupName, true); + uri.AppendPath("/moveResources", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + /// The name of the resource group containing the resources to move. + /// Parameters for moving resources. + /// The cancellation token to use. + public async ValueTask MoveResourcesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken = default) + { + if (sourceResourceGroupName == null) + { + throw new ArgumentNullException(nameof(sourceResourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateMoveResourcesRequest(sourceResourceGroupName, parameters); + 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); + } + } + + /// The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + /// The name of the resource group containing the resources to move. + /// Parameters for moving resources. + /// The cancellation token to use. + public Response MoveResources(string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken = default) + { + if (sourceResourceGroupName == null) + { + throw new ArgumentNullException(nameof(sourceResourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateMoveResourcesRequest(sourceResourceGroupName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateValidateMoveResourcesRequest(string sourceResourceGroupName, ResourcesMoveInfo parameters) + { + 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(sourceResourceGroupName, true); + uri.AppendPath("/validateMoveResources", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + /// The name of the resource group containing the resources to validate for move. + /// Parameters for moving resources. + /// The cancellation token to use. + public async ValueTask ValidateMoveResourcesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken = default) + { + if (sourceResourceGroupName == null) + { + throw new ArgumentNullException(nameof(sourceResourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateValidateMoveResourcesRequest(sourceResourceGroupName, parameters); + 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); + } + } + + /// This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + /// The name of the resource group containing the resources to validate for move. + /// Parameters for moving resources. + /// The cancellation token to use. + public Response ValidateMoveResources(string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken = default) + { + if (sourceResourceGroupName == null) + { + throw new ArgumentNullException(nameof(sourceResourceGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateValidateMoveResourcesRequest(sourceResourceGroupName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListRequest(string filter, string expand, int? top) + { + 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("/resources", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Get all the resources in a subscription. + /// The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + /// The number of results to return. If null is passed, returns all resource groups. + /// The cancellation token to use. + public async ValueTask> ListAsync(string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(filter, expand, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the resources in a subscription. + /// The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + /// The number of results to return. If null is passed, returns all resource groups. + /// The cancellation token to use. + public Response List(string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(filter, expand, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCheckExistenceRequest(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + 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/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/", false); + uri.AppendPath(parentResourcePath, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceType, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + return message; + } + + /// Checks whether a resource exists. + /// The name of the resource group containing the resource to check. The name is case insensitive. + /// The resource provider of the resource to check. + /// The parent resource identity. + /// The resource type. + /// The name of the resource to check whether it exists. + /// The API version to use for the operation. + /// The cancellation token to use. + public async ValueTask CheckExistenceAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var message = CreateCheckExistenceRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Checks whether a resource exists. + /// The name of the resource group containing the resource to check. The name is case insensitive. + /// The resource provider of the resource to check. + /// The parent resource identity. + /// The resource type. + /// The name of the resource to check whether it exists. + /// The API version to use for the operation. + /// The cancellation token to use. + public Response CheckExistence(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var message = CreateCheckExistenceRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteRequest(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion) + { + 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/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/", false); + uri.AppendPath(parentResourcePath, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceType, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + return message; + } + + /// Deletes a resource. + /// The name of the resource group that contains the resource to delete. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type. + /// The name of the resource to delete. + /// The API version to use for the operation. + /// The cancellation token to use. + public async ValueTask DeleteAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var message = CreateDeleteRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes a resource. + /// The name of the resource group that contains the resource to delete. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type. + /// The name of the resource to delete. + /// The API version to use for the operation. + /// The cancellation token to use. + public Response Delete(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var message = CreateDeleteRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters) + { + 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/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/", false); + uri.AppendPath(parentResourcePath, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceType, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Creates a resource. + /// The name of the resource group for the resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource to create. + /// The name of the resource to create. + /// The API version to use for the operation. + /// Parameters for creating or updating the resource. + /// The cancellation token to use. + public async ValueTask CreateOrUpdateAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates a resource. + /// The name of the resource group for the resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource to create. + /// The name of the resource to create. + /// The API version to use for the operation. + /// Parameters for creating or updating the resource. + /// The cancellation token to use. + public Response CreateOrUpdate(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateUpdateRequest(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters) + { + 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/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/", false); + uri.AppendPath(parentResourcePath, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceType, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Updates a resource. + /// The name of the resource group for the resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource to update. + /// The name of the resource to update. + /// The API version to use for the operation. + /// Parameters for updating the resource. + /// The cancellation token to use. + public async ValueTask UpdateAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Updates a resource. + /// The name of the resource group for the resource. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource to update. + /// The name of the resource to update. + /// The API version to use for the operation. + /// Parameters for updating the resource. + /// The cancellation token to use. + public Response Update(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetRequest(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion) + { + 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/", false); + uri.AppendPath(resourceProviderNamespace, true); + uri.AppendPath("/", false); + uri.AppendPath(parentResourcePath, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceType, false); + uri.AppendPath("/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + return message; + } + + /// Gets a resource. + /// The name of the resource group containing the resource to get. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource. + /// The name of the resource to get. + /// The API version to use for the operation. + /// The cancellation token to use. + public async ValueTask> GetAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var message = CreateGetRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GenericResource value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = GenericResource.DeserializeGenericResource(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a resource. + /// The name of the resource group containing the resource to get. The name is case insensitive. + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource. + /// The name of the resource to get. + /// The API version to use for the operation. + /// The cancellation token to use. + public Response Get(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (resourceProviderNamespace == null) + { + throw new ArgumentNullException(nameof(resourceProviderNamespace)); + } + if (parentResourcePath == null) + { + throw new ArgumentNullException(nameof(parentResourcePath)); + } + if (resourceType == null) + { + throw new ArgumentNullException(nameof(resourceType)); + } + if (resourceName == null) + { + throw new ArgumentNullException(nameof(resourceName)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var message = CreateGetRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GenericResource value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = GenericResource.DeserializeGenericResource(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCheckExistenceByIdRequest(string resourceId, string apiVersion) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceId, false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + return message; + } + + /// Checks by ID whether a resource exists. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// The cancellation token to use. + public async ValueTask CheckExistenceByIdAsync(string resourceId, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var message = CreateCheckExistenceByIdRequest(resourceId, apiVersion); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Checks by ID whether a resource exists. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// The cancellation token to use. + public Response CheckExistenceById(string resourceId, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var message = CreateCheckExistenceByIdRequest(resourceId, apiVersion); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteByIdRequest(string resourceId, string apiVersion) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceId, false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + return message; + } + + /// Deletes a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// The cancellation token to use. + public async ValueTask DeleteByIdAsync(string resourceId, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var message = CreateDeleteByIdRequest(resourceId, apiVersion); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// The cancellation token to use. + public Response DeleteById(string resourceId, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var message = CreateDeleteByIdRequest(resourceId, apiVersion); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateByIdRequest(string resourceId, string apiVersion, GenericResource parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceId, false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Create a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// Create or update resource parameters. + /// The cancellation token to use. + public async ValueTask CreateOrUpdateByIdAsync(string resourceId, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateByIdRequest(resourceId, apiVersion, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// Create or update resource parameters. + /// The cancellation token to use. + public Response CreateOrUpdateById(string resourceId, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateByIdRequest(resourceId, apiVersion, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateUpdateByIdRequest(string resourceId, string apiVersion, GenericResource parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceId, false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Updates a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// Update resource parameters. + /// The cancellation token to use. + public async ValueTask UpdateByIdAsync(string resourceId, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateByIdRequest(resourceId, apiVersion, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Updates a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// Update resource parameters. + /// The cancellation token to use. + public Response UpdateById(string resourceId, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateByIdRequest(resourceId, apiVersion, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetByIdRequest(string resourceId, string apiVersion) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceId, false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + return message; + } + + /// Gets a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// The cancellation token to use. + public async ValueTask> GetByIdAsync(string resourceId, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var message = CreateGetByIdRequest(resourceId, apiVersion); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GenericResource value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = GenericResource.DeserializeGenericResource(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a resource by ID. + /// The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + /// The API version to use for the operation. + /// The cancellation token to use. + public Response GetById(string resourceId, string apiVersion, CancellationToken cancellationToken = default) + { + if (resourceId == null) + { + throw new ArgumentNullException(nameof(resourceId)); + } + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + using var message = CreateGetByIdRequest(resourceId, apiVersion); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GenericResource value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = GenericResource.DeserializeGenericResource(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName, string filter, string expand, int? top) + { + 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; + return message; + } + + /// Get all the resources for a resource group. + /// The URL to the next page of results. + /// The resource group with the resources to get. + /// The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + /// The number of results to return. If null is passed, returns all resources. + /// The cancellation token to use. + public async ValueTask> ListByResourceGroupNextPageAsync(string nextLink, string resourceGroupName, string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, filter, expand, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the resources for a resource group. + /// The URL to the next page of results. + /// The resource group with the resources to get. + /// The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + /// The number of results to return. If null is passed, returns all resources. + /// The cancellation token to use. + public Response ListByResourceGroupNextPage(string nextLink, string resourceGroupName, string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, filter, expand, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListNextPageRequest(string nextLink, string filter, string expand, int? top) + { + 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; + return message; + } + + /// Get all the resources in a subscription. + /// The URL to the next page of results. + /// The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + /// The number of results to return. If null is passed, returns all resource groups. + /// The cancellation token to use. + public async ValueTask> ListNextPageAsync(string nextLink, string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink, filter, expand, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get all the resources in a subscription. + /// The URL to the next page of results. + /// The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + /// The number of results to return. If null is passed, returns all resource groups. + /// The cancellation token to use. + public Response ListNextPage(string nextLink, string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink, filter, expand, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesUpdateByIdOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesUpdateByIdOperation.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesUpdateByIdOperation.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/ResourcesUpdateByIdOperation.cs index 62d7702402b7..3739cf9ae556 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesUpdateByIdOperation.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesUpdateByIdOperation.cs @@ -12,9 +12,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// Updates a resource by ID. public partial class ResourcesUpdateByIdOperation : Operation, IOperationSource diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesUpdateOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesUpdateOperation.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesUpdateOperation.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/ResourcesUpdateOperation.cs index a70c10a42c82..b5147e6b18f7 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesUpdateOperation.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesUpdateOperation.cs @@ -12,9 +12,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// Updates a resource. public partial class ResourcesUpdateOperation : Operation, IOperationSource diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesValidateMoveResourcesOperation.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesValidateMoveResourcesOperation.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesValidateMoveResourcesOperation.cs rename to sdk/resources/Azure.Management.Resources/src/Generated/ResourcesValidateMoveResourcesOperation.cs index c3fcc652f9f1..6b9e6e9c27fb 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesValidateMoveResourcesOperation.cs +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ResourcesValidateMoveResourcesOperation.cs @@ -12,7 +12,7 @@ using Azure.Core; using Azure.Core.Pipeline; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. public partial class ResourcesValidateMoveResourcesOperation : Operation, IOperationSource diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ServiceClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ServiceClient.cs new file mode 100644 index 000000000000..a9f471ab701d --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ServiceClient.cs @@ -0,0 +1,113 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The Service service client. + public partial class ServiceClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ServiceRestClient RestClient { get; } + /// Initializes a new instance of ServiceClient for mocking. + protected ServiceClient() + { + } + /// Initializes a new instance of ServiceClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + internal ServiceClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + RestClient = new ServiceRestClient(clientDiagnostics, pipeline, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Lists all of the available Microsoft.Features REST API operations. + /// The cancellation token to use. + public virtual AsyncPageable ListOperationsAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServiceClient.ListOperations"); + scope.Start(); + try + { + var response = await RestClient.ListOperationsAsync(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("ServiceClient.ListOperations"); + scope.Start(); + try + { + var response = await RestClient.ListOperationsNextPageAsync(nextLink, 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); + } + + /// Lists all of the available Microsoft.Features REST API operations. + /// The cancellation token to use. + public virtual Pageable ListOperations(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServiceClient.ListOperations"); + scope.Start(); + try + { + var response = RestClient.ListOperations(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("ServiceClient.ListOperations"); + scope.Start(); + try + { + var response = RestClient.ListOperationsNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/ServiceRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/ServiceRestClient.cs new file mode 100644 index 000000000000..e322a557d1c7 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/ServiceRestClient.cs @@ -0,0 +1,183 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class ServiceRestClient + { + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ServiceRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + public ServiceRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + endpoint ??= new Uri("https://management.azure.com"); + + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateListOperationsRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.Features/operations", false); + uri.AppendQuery("api-version", "2015-12-01", true); + request.Uri = uri; + return message; + } + + /// Lists all of the available Microsoft.Features REST API operations. + /// The cancellation token to use. + public async ValueTask> ListOperationsAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListOperationsRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResultAutoGenerated value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = OperationListResultAutoGenerated.DeserializeOperationListResultAutoGenerated(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists all of the available Microsoft.Features REST API operations. + /// The cancellation token to use. + public Response ListOperations(CancellationToken cancellationToken = default) + { + using var message = CreateListOperationsRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResultAutoGenerated value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = OperationListResultAutoGenerated.DeserializeOperationListResultAutoGenerated(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListOperationsNextPageRequest(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; + return message; + } + + /// Lists all of the available Microsoft.Features REST API operations. + /// The URL to the next page of results. + /// The cancellation token to use. + public async ValueTask> ListOperationsNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListOperationsNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResultAutoGenerated value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = OperationListResultAutoGenerated.DeserializeOperationListResultAutoGenerated(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists all of the available Microsoft.Features REST API operations. + /// The URL to the next page of results. + /// The cancellation token to use. + public Response ListOperationsNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListOperationsNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResultAutoGenerated value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = OperationListResultAutoGenerated.DeserializeOperationListResultAutoGenerated(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/SubscriptionsClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/SubscriptionsClient.cs new file mode 100644 index 000000000000..bbdeef8e84e5 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/SubscriptionsClient.cs @@ -0,0 +1,205 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The Subscriptions service client. + public partial class SubscriptionsClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal SubscriptionsRestClient RestClient { get; } + /// Initializes a new instance of SubscriptionsClient for mocking. + protected SubscriptionsClient() + { + } + /// Initializes a new instance of SubscriptionsClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + internal SubscriptionsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + RestClient = new SubscriptionsRestClient(clientDiagnostics, pipeline, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets details about a specified subscription. + /// The ID of the target subscription. + /// The cancellation token to use. + public virtual async Task> GetAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SubscriptionsClient.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(subscriptionId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details about a specified subscription. + /// The ID of the target subscription. + /// The cancellation token to use. + public virtual Response Get(string subscriptionId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SubscriptionsClient.Get"); + scope.Start(); + try + { + return RestClient.Get(subscriptionId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + /// The ID of the target subscription. + /// The cancellation token to use. + public virtual AsyncPageable ListLocationsAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SubscriptionsClient.ListLocations"); + scope.Start(); + try + { + var response = await RestClient.ListLocationsAsync(subscriptionId, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + /// The ID of the target subscription. + /// The cancellation token to use. + public virtual Pageable ListLocations(string subscriptionId, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SubscriptionsClient.ListLocations"); + scope.Start(); + try + { + var response = RestClient.ListLocations(subscriptionId, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Gets all subscriptions for a tenant. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SubscriptionsClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(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("SubscriptionsClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, 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); + } + + /// Gets all subscriptions for a tenant. + /// The cancellation token to use. + public virtual Pageable List(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SubscriptionsClient.List"); + scope.Start(); + try + { + var response = RestClient.List(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("SubscriptionsClient.List"); + scope.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/SubscriptionsRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/SubscriptionsRestClient.cs new file mode 100644 index 000000000000..73cf8ecd7dcc --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/SubscriptionsRestClient.cs @@ -0,0 +1,344 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class SubscriptionsRestClient + { + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of SubscriptionsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + public SubscriptionsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + endpoint ??= new Uri("https://management.azure.com"); + + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateListLocationsRequest(string subscriptionId) + { + 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("/locations", false); + uri.AppendQuery("api-version", "2019-11-01", true); + request.Uri = uri; + return message; + } + + /// This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + /// The ID of the target subscription. + /// The cancellation token to use. + public async ValueTask> ListLocationsAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + + using var message = CreateListLocationsRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LocationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = LocationListResult.DeserializeLocationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + /// The ID of the target subscription. + /// The cancellation token to use. + public Response ListLocations(string subscriptionId, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + + using var message = CreateListLocationsRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LocationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = LocationListResult.DeserializeLocationListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetRequest(string subscriptionId) + { + 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.AppendQuery("api-version", "2019-11-01", true); + request.Uri = uri; + return message; + } + + /// Gets details about a specified subscription. + /// The ID of the target subscription. + /// The cancellation token to use. + public async ValueTask> GetAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + + using var message = CreateGetRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Subscription value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Subscription.DeserializeSubscription(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets details about a specified subscription. + /// The ID of the target subscription. + /// The cancellation token to use. + public Response Get(string subscriptionId, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + + using var message = CreateGetRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Subscription value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Subscription.DeserializeSubscription(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions", false); + uri.AppendQuery("api-version", "2019-11-01", true); + request.Uri = uri; + return message; + } + + /// Gets all subscriptions for a tenant. + /// The cancellation token to use. + public async ValueTask> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = SubscriptionListResult.DeserializeSubscriptionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all subscriptions for a tenant. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = SubscriptionListResult.DeserializeSubscriptionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListNextPageRequest(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; + return message; + } + + /// Gets all subscriptions for a tenant. + /// The URL to the next page of results. + /// The cancellation token to use. + public async ValueTask> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = SubscriptionListResult.DeserializeSubscriptionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all subscriptions for a tenant. + /// The URL to the next page of results. + /// The cancellation token to use. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = SubscriptionListResult.DeserializeSubscriptionListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/TagsClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/TagsClient.cs new file mode 100644 index 000000000000..7a09659b8394 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/TagsClient.cs @@ -0,0 +1,410 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The Tags service client. + public partial class TagsClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal TagsRestClient RestClient { get; } + /// Initializes a new instance of TagsClient for mocking. + protected TagsClient() + { + } + /// Initializes a new instance of TagsClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + internal TagsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new TagsRestClient(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// This operation allows deleting a value from the list of predefined values for an existing predefined tag name. The value being deleted must not be in use as a tag value for the given tag name for any resource. + /// The name of the tag. + /// The value of the tag to delete. + /// The cancellation token to use. + public virtual async Task DeleteValueAsync(string tagName, string tagValue, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TagsClient.DeleteValue"); + scope.Start(); + try + { + return await RestClient.DeleteValueAsync(tagName, tagValue, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation allows deleting a value from the list of predefined values for an existing predefined tag name. The value being deleted must not be in use as a tag value for the given tag name for any resource. + /// The name of the tag. + /// The value of the tag to delete. + /// The cancellation token to use. + public virtual Response DeleteValue(string tagName, string tagValue, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TagsClient.DeleteValue"); + scope.Start(); + try + { + return RestClient.DeleteValue(tagName, tagValue, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag value can have a maximum of 256 characters. + /// The name of the tag. + /// The value of the tag to create. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateValueAsync(string tagName, string tagValue, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TagsClient.CreateOrUpdateValue"); + scope.Start(); + try + { + return await RestClient.CreateOrUpdateValueAsync(tagName, tagValue, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag value can have a maximum of 256 characters. + /// The name of the tag. + /// The value of the tag to create. + /// The cancellation token to use. + public virtual Response CreateOrUpdateValue(string tagName, string tagValue, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TagsClient.CreateOrUpdateValue"); + scope.Start(); + try + { + return RestClient.CreateOrUpdateValue(tagName, tagValue, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which are reserved for Azure use: 'microsoft', 'azure', 'windows'. + /// The name of the tag to create. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAsync(string tagName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TagsClient.CreateOrUpdate"); + scope.Start(); + try + { + return await RestClient.CreateOrUpdateAsync(tagName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which are reserved for Azure use: 'microsoft', 'azure', 'windows'. + /// The name of the tag to create. + /// The cancellation token to use. + public virtual Response CreateOrUpdate(string tagName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TagsClient.CreateOrUpdate"); + scope.Start(); + try + { + return RestClient.CreateOrUpdate(tagName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation allows deleting a name from the list of predefined tag names for the given subscription. The name being deleted must not be in use as a tag name for any resource. All predefined values for the given name must have already been deleted. + /// The name of the tag. + /// The cancellation token to use. + public virtual async Task DeleteAsync(string tagName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TagsClient.Delete"); + scope.Start(); + try + { + return await RestClient.DeleteAsync(tagName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation allows deleting a name from the list of predefined tag names for the given subscription. The name being deleted must not be in use as a tag name for any resource. All predefined values for the given name must have already been deleted. + /// The name of the tag. + /// The cancellation token to use. + public virtual Response Delete(string tagName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TagsClient.Delete"); + scope.Start(); + try + { + return RestClient.Delete(tagName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags. + /// The resource scope. + /// The TagsResource to use. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAtScopeAsync(string scope, TagsResource parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("TagsClient.CreateOrUpdateAtScope"); + scope0.Start(); + try + { + return await RestClient.CreateOrUpdateAtScopeAsync(scope, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags. + /// The resource scope. + /// The TagsResource to use. + /// The cancellation token to use. + public virtual Response CreateOrUpdateAtScope(string scope, TagsResource parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("TagsClient.CreateOrUpdateAtScope"); + scope0.Start(); + try + { + return RestClient.CreateOrUpdateAtScope(scope, parameters, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or name/value pairs. + /// The resource scope. + /// The TagsPatchResource to use. + /// The cancellation token to use. + public virtual async Task> UpdateAtScopeAsync(string scope, TagsPatchResource parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("TagsClient.UpdateAtScope"); + scope0.Start(); + try + { + return await RestClient.UpdateAtScopeAsync(scope, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or name/value pairs. + /// The resource scope. + /// The TagsPatchResource to use. + /// The cancellation token to use. + public virtual Response UpdateAtScope(string scope, TagsPatchResource parameters, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("TagsClient.UpdateAtScope"); + scope0.Start(); + try + { + return RestClient.UpdateAtScope(scope, parameters, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets the entire set of tags on a resource or subscription. + /// The resource scope. + /// The cancellation token to use. + public virtual async Task> GetAtScopeAsync(string scope, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("TagsClient.GetAtScope"); + scope0.Start(); + try + { + return await RestClient.GetAtScopeAsync(scope, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Gets the entire set of tags on a resource or subscription. + /// The resource scope. + /// The cancellation token to use. + public virtual Response GetAtScope(string scope, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("TagsClient.GetAtScope"); + scope0.Start(); + try + { + return RestClient.GetAtScope(scope, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Deletes the entire set of tags on a resource or subscription. + /// The resource scope. + /// The cancellation token to use. + public virtual async Task DeleteAtScopeAsync(string scope, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("TagsClient.DeleteAtScope"); + scope0.Start(); + try + { + return await RestClient.DeleteAtScopeAsync(scope, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Deletes the entire set of tags on a resource or subscription. + /// The resource scope. + /// The cancellation token to use. + public virtual Response DeleteAtScope(string scope, CancellationToken cancellationToken = default) + { + using var scope0 = _clientDiagnostics.CreateScope("TagsClient.DeleteAtScope"); + scope0.Start(); + try + { + return RestClient.DeleteAtScope(scope, cancellationToken); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and returns a summary of usage for each tag name and value under the given subscription. In case of a large number of tags, this operation may return a previously cached result. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("TagsClient.List"); + scope0.Start(); + try + { + var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("TagsClient.List"); + scope0.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and returns a summary of usage for each tag name and value under the given subscription. In case of a large number of tags, this operation may return a previously cached result. + /// The cancellation token to use. + public virtual Pageable List(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("TagsClient.List"); + scope0.Start(); + try + { + var response = RestClient.List(cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope0 = _clientDiagnostics.CreateScope("TagsClient.List"); + scope0.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/TagsRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/TagsRestClient.cs new file mode 100644 index 000000000000..06a651283179 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/TagsRestClient.cs @@ -0,0 +1,833 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class TagsRestClient + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of TagsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// This occurs when one of the required arguments is null. + public TagsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateDeleteValueRequest(string tagName, string tagValue) + { + 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("/tagNames/", false); + uri.AppendPath(tagName, true); + uri.AppendPath("/tagValues/", false); + uri.AppendPath(tagValue, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// This operation allows deleting a value from the list of predefined values for an existing predefined tag name. The value being deleted must not be in use as a tag value for the given tag name for any resource. + /// The name of the tag. + /// The value of the tag to delete. + /// The cancellation token to use. + public async ValueTask DeleteValueAsync(string tagName, string tagValue, CancellationToken cancellationToken = default) + { + if (tagName == null) + { + throw new ArgumentNullException(nameof(tagName)); + } + if (tagValue == null) + { + throw new ArgumentNullException(nameof(tagValue)); + } + + using var message = CreateDeleteValueRequest(tagName, tagValue); + 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); + } + } + + /// This operation allows deleting a value from the list of predefined values for an existing predefined tag name. The value being deleted must not be in use as a tag value for the given tag name for any resource. + /// The name of the tag. + /// The value of the tag to delete. + /// The cancellation token to use. + public Response DeleteValue(string tagName, string tagValue, CancellationToken cancellationToken = default) + { + if (tagName == null) + { + throw new ArgumentNullException(nameof(tagName)); + } + if (tagValue == null) + { + throw new ArgumentNullException(nameof(tagValue)); + } + + using var message = CreateDeleteValueRequest(tagName, tagValue); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateValueRequest(string tagName, string tagValue) + { + 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("/tagNames/", false); + uri.AppendPath(tagName, true); + uri.AppendPath("/tagValues/", false); + uri.AppendPath(tagValue, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag value can have a maximum of 256 characters. + /// The name of the tag. + /// The value of the tag to create. + /// The cancellation token to use. + public async ValueTask> CreateOrUpdateValueAsync(string tagName, string tagValue, CancellationToken cancellationToken = default) + { + if (tagName == null) + { + throw new ArgumentNullException(nameof(tagName)); + } + if (tagValue == null) + { + throw new ArgumentNullException(nameof(tagValue)); + } + + using var message = CreateCreateOrUpdateValueRequest(tagName, tagValue); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagValue value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagValue.DeserializeTagValue(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag value can have a maximum of 256 characters. + /// The name of the tag. + /// The value of the tag to create. + /// The cancellation token to use. + public Response CreateOrUpdateValue(string tagName, string tagValue, CancellationToken cancellationToken = default) + { + if (tagName == null) + { + throw new ArgumentNullException(nameof(tagName)); + } + if (tagValue == null) + { + throw new ArgumentNullException(nameof(tagValue)); + } + + using var message = CreateCreateOrUpdateValueRequest(tagName, tagValue); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagValue value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagValue.DeserializeTagValue(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateRequest(string tagName) + { + 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("/tagNames/", false); + uri.AppendPath(tagName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which are reserved for Azure use: 'microsoft', 'azure', 'windows'. + /// The name of the tag to create. + /// The cancellation token to use. + public async ValueTask> CreateOrUpdateAsync(string tagName, CancellationToken cancellationToken = default) + { + if (tagName == null) + { + throw new ArgumentNullException(nameof(tagName)); + } + + using var message = CreateCreateOrUpdateRequest(tagName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagDetails value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagDetails.DeserializeTagDetails(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which are reserved for Azure use: 'microsoft', 'azure', 'windows'. + /// The name of the tag to create. + /// The cancellation token to use. + public Response CreateOrUpdate(string tagName, CancellationToken cancellationToken = default) + { + if (tagName == null) + { + throw new ArgumentNullException(nameof(tagName)); + } + + using var message = CreateCreateOrUpdateRequest(tagName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagDetails value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagDetails.DeserializeTagDetails(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteRequest(string tagName) + { + 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("/tagNames/", false); + uri.AppendPath(tagName, true); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// This operation allows deleting a name from the list of predefined tag names for the given subscription. The name being deleted must not be in use as a tag name for any resource. All predefined values for the given name must have already been deleted. + /// The name of the tag. + /// The cancellation token to use. + public async ValueTask DeleteAsync(string tagName, CancellationToken cancellationToken = default) + { + if (tagName == null) + { + throw new ArgumentNullException(nameof(tagName)); + } + + using var message = CreateDeleteRequest(tagName); + 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); + } + } + + /// This operation allows deleting a name from the list of predefined tag names for the given subscription. The name being deleted must not be in use as a tag name for any resource. All predefined values for the given name must have already been deleted. + /// The name of the tag. + /// The cancellation token to use. + public Response Delete(string tagName, CancellationToken cancellationToken = default) + { + if (tagName == null) + { + throw new ArgumentNullException(nameof(tagName)); + } + + using var message = CreateDeleteRequest(tagName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListRequest() + { + 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("/tagNames", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and returns a summary of usage for each tag name and value under the given subscription. In case of a large number of tags, this operation may return a previously cached result. + /// The cancellation token to use. + public async ValueTask> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagsListResult.DeserializeTagsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and returns a summary of usage for each tag name and value under the given subscription. In case of a large number of tags, this operation may return a previously cached result. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagsListResult.DeserializeTagsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateCreateOrUpdateAtScopeRequest(string scope, TagsResource parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/tags/default", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags. + /// The resource scope. + /// The TagsResource to use. + /// The cancellation token to use. + public async ValueTask> CreateOrUpdateAtScopeAsync(string scope, TagsResource parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtScopeRequest(scope, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagsResource value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagsResource.DeserializeTagsResource(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags. + /// The resource scope. + /// The TagsResource to use. + /// The cancellation token to use. + public Response CreateOrUpdateAtScope(string scope, TagsResource parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateAtScopeRequest(scope, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagsResource value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagsResource.DeserializeTagsResource(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateUpdateAtScopeRequest(string scope, TagsPatchResource parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/tags/default", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + using var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or name/value pairs. + /// The resource scope. + /// The TagsPatchResource to use. + /// The cancellation token to use. + public async ValueTask> UpdateAtScopeAsync(string scope, TagsPatchResource parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateAtScopeRequest(scope, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagsResource value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagsResource.DeserializeTagsResource(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or name/value pairs. + /// The resource scope. + /// The TagsPatchResource to use. + /// The cancellation token to use. + public Response UpdateAtScope(string scope, TagsPatchResource parameters, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateAtScopeRequest(scope, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagsResource value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagsResource.DeserializeTagsResource(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateGetAtScopeRequest(string scope) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/tags/default", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Gets the entire set of tags on a resource or subscription. + /// The resource scope. + /// The cancellation token to use. + public async ValueTask> GetAtScopeAsync(string scope, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateGetAtScopeRequest(scope); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagsResource value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagsResource.DeserializeTagsResource(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the entire set of tags on a resource or subscription. + /// The resource scope. + /// The cancellation token to use. + public Response GetAtScope(string scope, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateGetAtScopeRequest(scope); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagsResource value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagsResource.DeserializeTagsResource(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateDeleteAtScopeRequest(string scope) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/tags/default", false); + uri.AppendQuery("api-version", "2019-10-01", true); + request.Uri = uri; + return message; + } + + /// Deletes the entire set of tags on a resource or subscription. + /// The resource scope. + /// The cancellation token to use. + public async ValueTask DeleteAtScopeAsync(string scope, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateDeleteAtScopeRequest(scope); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes the entire set of tags on a resource or subscription. + /// The resource scope. + /// The cancellation token to use. + public Response DeleteAtScope(string scope, CancellationToken cancellationToken = default) + { + if (scope == null) + { + throw new ArgumentNullException(nameof(scope)); + } + + using var message = CreateDeleteAtScopeRequest(scope); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListNextPageRequest(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; + return message; + } + + /// This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and returns a summary of usage for each tag name and value under the given subscription. In case of a large number of tags, this operation may return a previously cached result. + /// The URL to the next page of results. + /// The cancellation token to use. + public async ValueTask> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagsListResult.DeserializeTagsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and returns a summary of usage for each tag name and value under the given subscription. In case of a large number of tags, this operation may return a previously cached result. + /// The URL to the next page of results. + /// The cancellation token to use. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TagsListResult.DeserializeTagsListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/TenantsClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/TenantsClient.cs new file mode 100644 index 000000000000..3f5ed4ea1293 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/TenantsClient.cs @@ -0,0 +1,113 @@ +// 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; +using Azure.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// The Tenants service client. + public partial class TenantsClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal TenantsRestClient RestClient { get; } + /// Initializes a new instance of TenantsClient for mocking. + protected TenantsClient() + { + } + /// Initializes a new instance of TenantsClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + internal TenantsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + RestClient = new TenantsRestClient(clientDiagnostics, pipeline, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the tenants for your account. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("TenantsClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(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("TenantsClient.List"); + scope.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, 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); + } + + /// Gets the tenants for your account. + /// The cancellation token to use. + public virtual Pageable List(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("TenantsClient.List"); + scope.Start(); + try + { + var response = RestClient.List(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("TenantsClient.List"); + scope.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Generated/TenantsRestClient.cs b/sdk/resources/Azure.Management.Resources/src/Generated/TenantsRestClient.cs new file mode 100644 index 000000000000..4bf6c845ca65 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/Generated/TenantsRestClient.cs @@ -0,0 +1,183 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + internal partial class TenantsRestClient + { + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of TenantsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + public TenantsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + endpoint ??= new Uri("https://management.azure.com"); + + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal Core.HttpMessage CreateListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/tenants", false); + uri.AppendQuery("api-version", "2019-11-01", true); + request.Uri = uri; + return message; + } + + /// Gets the tenants for your account. + /// The cancellation token to use. + public async ValueTask> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TenantListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TenantListResult.DeserializeTenantListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the tenants for your account. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TenantListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TenantListResult.DeserializeTenantListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal Core.HttpMessage CreateListNextPageRequest(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; + return message; + } + + /// Gets the tenants for your account. + /// The URL to the next page of results. + /// The cancellation token to use. + public async ValueTask> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TenantListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TenantListResult.DeserializeTenantListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the tenants for your account. + /// The URL to the next page of results. + /// The cancellation token to use. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TenantListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = TenantListResult.DeserializeTenantListResult(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/src/Properties/AssemblyInfo.cs b/sdk/resources/Azure.Management.Resources/src/Properties/AssemblyInfo.cs index feb9761a31c9..8f96e9b625f9 100644 --- a/sdk/resources/Azure.Management.Resources/src/Properties/AssemblyInfo.cs +++ b/sdk/resources/Azure.Management.Resources/src/Properties/AssemblyInfo.cs @@ -5,4 +5,4 @@ [assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Resources")] -[assembly: InternalsVisibleTo("Azure.Management.Resources.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] +[assembly: InternalsVisibleTo("Azure.Management.Resource.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/resources/Azure.Management.Resources/src/autorest.md b/sdk/resources/Azure.Management.Resources/src/autorest.md new file mode 100644 index 000000000000..0195acb65656 --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/src/autorest.md @@ -0,0 +1,27 @@ +# Generated code configuration + +Run `dotnet msbuild /t:GenerateCode` to generate code. + +``` yaml +azure-arm: true +input-file: + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f9d1625a69e739f362dd16e32f8f9e8fa01abd37/specification/resources/resource-manager/Microsoft.Resources/stable/2019-10-01/resources.json + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f9d1625a69e739f362dd16e32f8f9e8fa01abd37/specification/resources/resource-manager/Microsoft.Resources/stable/2019-11-01/subscriptions.json + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f9d1625a69e739f362dd16e32f8f9e8fa01abd37/specification/resources/resource-manager/Microsoft.Authorization/stable/2019-09-01/policyAssignments.json + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f9d1625a69e739f362dd16e32f8f9e8fa01abd37/specification/resources/resource-manager/Microsoft.Authorization/stable/2019-09-01/policyDefinitions.json + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f9d1625a69e739f362dd16e32f8f9e8fa01abd37/specification/resources/resource-manager/Microsoft.Authorization/stable/2019-09-01/policySetDefinitions.json + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f9d1625a69e739f362dd16e32f8f9e8fa01abd37/specification/resources/resource-manager/Microsoft.Resources/preview/2019-10-01-preview/deploymentScripts.json + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f9d1625a69e739f362dd16e32f8f9e8fa01abd37/specification/resources/resource-manager/Microsoft.Features/stable/2015-12-01/features.json + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f9d1625a69e739f362dd16e32f8f9e8fa01abd37/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/locks.json + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f9d1625a69e739f362dd16e32f8f9e8fa01abd37/specification/resources/resource-manager/Microsoft.Resources/stable/2016-09-01/links.json + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f9d1625a69e739f362dd16e32f8f9e8fa01abd37/specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/managedapplications.json +modelerfour: + lenient-model-deduplication: true +directive: + - from: subscriptions.json + where: $.paths + transform: delete $["/providers/Microsoft.Resources/operations"] + - from: links.json + where: $.paths + transform: delete $["/providers/Microsoft.Resources/operations"] +``` diff --git a/sdk/resources/Azure.Management.Resources/tests/Azure.Management.Resources.Tests.csproj b/sdk/resources/Azure.Management.Resources/tests/Azure.Management.Resources.Tests.csproj index e2b6d86db1a0..d85e792e26bc 100644 --- a/sdk/resources/Azure.Management.Resources/tests/Azure.Management.Resources.Tests.csproj +++ b/sdk/resources/Azure.Management.Resources/tests/Azure.Management.Resources.Tests.csproj @@ -1,5 +1,5 @@  - + diff --git a/sdk/resources/Azure.Management.Resources/tests/ResourceManagementTestEnvironment.cs b/sdk/resources/Azure.Management.Resources/tests/ResourceManagementTestEnvironment.cs new file mode 100644 index 000000000000..64767690d2cf --- /dev/null +++ b/sdk/resources/Azure.Management.Resources/tests/ResourceManagementTestEnvironment.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.Management.Resource.Tests +{ + public class ResourceManagementTestEnvironment : TestEnvironment + { + public ResourceManagementTestEnvironment() : base("resourcemgmt") + { + } + } +} diff --git a/sdk/resources/Azure.Management.Resources/tests/ResourcesManagementTestEnvironment.cs b/sdk/resources/Azure.Management.Resources/tests/ResourcesManagementTestEnvironment.cs deleted file mode 100644 index c4df16fa637a..000000000000 --- a/sdk/resources/Azure.Management.Resources/tests/ResourcesManagementTestEnvironment.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core.TestFramework; - -namespace Azure.Management.Resources.Tests -{ - public class ResourcesManagementTestEnvironment : TestEnvironment - { - public ResourcesManagementTestEnvironment() : base("resourcesmgmt") - { - } - } -} \ No newline at end of file diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/Azure.Management.Resource.sln b/sdk/testcommon/Azure.Management.Resource.2017_05/Azure.Management.Resource.sln deleted file mode 100644 index 3201fee059f8..000000000000 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/Azure.Management.Resource.sln +++ /dev/null @@ -1,37 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30011.22 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Management.Resource", "src\Azure.Management.Resource.csproj", "{4160E24C-43AC-4EF9-B4F7-49445F9B113D}" -EndProject -Global - 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 - {4160E24C-43AC-4EF9-B4F7-49445F9B113D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4160E24C-43AC-4EF9-B4F7-49445F9B113D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4160E24C-43AC-4EF9-B4F7-49445F9B113D}.Debug|x64.ActiveCfg = Debug|Any CPU - {4160E24C-43AC-4EF9-B4F7-49445F9B113D}.Debug|x64.Build.0 = Debug|Any CPU - {4160E24C-43AC-4EF9-B4F7-49445F9B113D}.Debug|x86.ActiveCfg = Debug|Any CPU - {4160E24C-43AC-4EF9-B4F7-49445F9B113D}.Debug|x86.Build.0 = Debug|Any CPU - {4160E24C-43AC-4EF9-B4F7-49445F9B113D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4160E24C-43AC-4EF9-B4F7-49445F9B113D}.Release|Any CPU.Build.0 = Release|Any CPU - {4160E24C-43AC-4EF9-B4F7-49445F9B113D}.Release|x64.ActiveCfg = Release|Any CPU - {4160E24C-43AC-4EF9-B4F7-49445F9B113D}.Release|x64.Build.0 = Release|Any CPU - {4160E24C-43AC-4EF9-B4F7-49445F9B113D}.Release|x86.ActiveCfg = Release|Any CPU - {4160E24C-43AC-4EF9-B4F7-49445F9B113D}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {6B72E8F2-D9D1-4AA7-9C17-FACE69D3249C} - EndGlobalSection -EndGlobal diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/Azure.Management.Resources.sln b/sdk/testcommon/Azure.Management.Resources.2017_05/Azure.Management.Resources.sln new file mode 100644 index 000000000000..9d41f6ac6995 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/Azure.Management.Resources.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Management.Resources", "src\Azure.Management.Resources.csproj", "{6B183C86-B2F8-402B-8C44-4FFE772674FC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6B183C86-B2F8-402B-8C44-4FFE772674FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6B183C86-B2F8-402B-8C44-4FFE772674FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6B183C86-B2F8-402B-8C44-4FFE772674FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6B183C86-B2F8-402B-8C44-4FFE772674FC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6B72E8F2-D9D1-4AA7-9C17-FACE69D3249C} + EndGlobalSection +EndGlobal diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/CHANGELOG.md b/sdk/testcommon/Azure.Management.Resources.2017_05/CHANGELOG.md similarity index 100% rename from sdk/testcommon/Azure.Management.Resource.2017_05/CHANGELOG.md rename to sdk/testcommon/Azure.Management.Resources.2017_05/CHANGELOG.md diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/Directory.Build.props b/sdk/testcommon/Azure.Management.Resources.2017_05/Directory.Build.props similarity index 100% rename from sdk/testcommon/Azure.Management.Resource.2017_05/Directory.Build.props rename to sdk/testcommon/Azure.Management.Resources.2017_05/Directory.Build.props diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/README.md b/sdk/testcommon/Azure.Management.Resources.2017_05/README.md similarity index 100% rename from sdk/testcommon/Azure.Management.Resource.2017_05/README.md rename to sdk/testcommon/Azure.Management.Resources.2017_05/README.md diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Azure.Management.Resource.csproj b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Azure.Management.Resources.csproj similarity index 85% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Azure.Management.Resource.csproj rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Azure.Management.Resources.csproj index b763a0d50cb7..10b30cfd95ce 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Azure.Management.Resource.csproj +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Azure.Management.Resources.csproj @@ -1,7 +1,7 @@  0.1.6-preview.1 - Azure.Management.Resource + Azure.Management.Resources Azure management client SDK for Azure resource provider Microsoft.Resources azure;management;resources $(NoWarn);AZC0008 diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentClient.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentClient.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentClient.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentClient.cs index 22f90b92b96f..8175d75ab10e 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentClient.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentClient.cs @@ -11,9 +11,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// The Deployment service client. public partial class DeploymentClient diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentRestClient.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentRestClient.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentRestClient.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentRestClient.cs index 0bbd547233df..5b1cac89f781 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentRestClient.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentRestClient.cs @@ -12,9 +12,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { internal partial class DeploymentRestClient { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentsClient.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentsClient.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentsClient.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentsClient.cs index 2b3a6cea0f43..53c0cc65f820 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentsClient.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentsClient.cs @@ -11,9 +11,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// The Deployments service client. public partial class DeploymentsClient diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentsCreateOrUpdateOperation.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentsCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..ae997fde3431 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentsCreateOrUpdateOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// You can provide the template and parameters directly in the request or link to JSON files. + public partial class DeploymentsCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DeploymentExtended 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); + + DeploymentExtended IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return DeploymentExtended.DeserializeDeploymentExtended(document.RootElement); + } + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentsDeleteOperation.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentsDeleteOperation.cs new file mode 100644 index 000000000000..8b19e4701367 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentsDeleteOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + public partial class DeploymentsDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DeploymentsDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentsDeleteOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentsRestClient.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentsRestClient.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentsRestClient.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentsRestClient.cs index 9f07e9adcc97..5f6f88121b88 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/DeploymentsRestClient.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/DeploymentsRestClient.cs @@ -12,9 +12,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { internal partial class DeploymentsRestClient { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/AliasPathType.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/AliasPathType.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/AliasPathType.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/AliasPathType.Serialization.cs index 4a3caaa29f7e..165f306c8809 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/AliasPathType.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/AliasPathType.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class AliasPathType { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/AliasPathType.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/AliasPathType.cs similarity index 95% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/AliasPathType.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/AliasPathType.cs index 446bafe1c750..69e9be3a30dc 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/AliasPathType.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/AliasPathType.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// The type of the paths for alias. public partial class AliasPathType diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/AliasType.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/AliasType.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/AliasType.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/AliasType.Serialization.cs index 489691ea506d..bb3d752a29f5 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/AliasType.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/AliasType.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class AliasType { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/AliasType.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/AliasType.cs similarity index 95% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/AliasType.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/AliasType.cs index 82840160c166..e68cc9058a6e 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/AliasType.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/AliasType.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// The alias type. public partial class AliasType diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/BasicDependency.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/BasicDependency.Serialization.cs new file mode 100644 index 000000000000..2d384e489e70 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/BasicDependency.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.Management.Resources.Models +{ + public partial class BasicDependency + { + internal static BasicDependency DeserializeBasicDependency(JsonElement element) + { + string id = default; + string resourceType = default; + string resourceName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceName = property.Value.GetString(); + continue; + } + } + return new BasicDependency(id, resourceType, resourceName); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/BasicDependency.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/BasicDependency.cs new file mode 100644 index 000000000000..c396807c5c20 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/BasicDependency.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Deployment dependency information. + public partial class BasicDependency + { + /// Initializes a new instance of BasicDependency. + internal BasicDependency() + { + } + + /// Initializes a new instance of BasicDependency. + /// The ID of the dependency. + /// The dependency resource type. + /// The dependency resource name. + internal BasicDependency(string id, string resourceType, string resourceName) + { + Id = id; + ResourceType = resourceType; + ResourceName = resourceName; + } + + /// The ID of the dependency. + public string Id { get; } + /// The dependency resource type. + public string ResourceType { get; } + /// The dependency resource name. + public string ResourceName { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/CloudError.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/CloudError.Serialization.cs new file mode 100644 index 000000000000..9ad53806052d --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/CloudError.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class CloudError + { + internal static CloudError DeserializeCloudError(JsonElement element) + { + ErrorResponse error = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("error")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ErrorResponse.DeserializeErrorResponse(property.Value); + continue; + } + } + return new CloudError(error); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/CloudError.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/CloudError.cs new file mode 100644 index 000000000000..42d839ebe9e0 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/CloudError.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// An error response for a resource management request. + public partial class CloudError + { + /// Initializes a new instance of CloudError. + internal CloudError() + { + } + + /// Initializes a new instance of CloudError. + /// The resource management error response. + internal CloudError(ErrorResponse error) + { + Error = error; + } + + /// The resource management error response. + public ErrorResponse Error { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DebugSetting.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DebugSetting.Serialization.cs new file mode 100644 index 000000000000..f1496dd6d3b1 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DebugSetting.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class DebugSetting : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (DetailLevel != null) + { + writer.WritePropertyName("detailLevel"); + writer.WriteStringValue(DetailLevel); + } + writer.WriteEndObject(); + } + + internal static DebugSetting DeserializeDebugSetting(JsonElement element) + { + string detailLevel = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("detailLevel")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detailLevel = property.Value.GetString(); + continue; + } + } + return new DebugSetting(detailLevel); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DebugSetting.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DebugSetting.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DebugSetting.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DebugSetting.cs index 13878c27a39c..edfb2aa5af04 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DebugSetting.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DebugSetting.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// The DebugSetting. public partial class DebugSetting diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Dependency.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Dependency.Serialization.cs new file mode 100644 index 000000000000..f7cc5c8ce22a --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Dependency.Serialization.cs @@ -0,0 +1,76 @@ +// 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.Management.Resources.Models +{ + public partial class Dependency + { + internal static Dependency DeserializeDependency(JsonElement element) + { + IReadOnlyList dependsOn = default; + string id = default; + string resourceType = default; + string resourceName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dependsOn")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(BasicDependency.DeserializeBasicDependency(item)); + } + } + dependsOn = array; + continue; + } + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceName = property.Value.GetString(); + continue; + } + } + return new Dependency(dependsOn, id, resourceType, resourceName); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Dependency.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Dependency.cs new file mode 100644 index 000000000000..311ee220aeee --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Dependency.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Deployment dependency information. + public partial class Dependency + { + /// Initializes a new instance of Dependency. + internal Dependency() + { + } + + /// Initializes a new instance of Dependency. + /// The list of dependencies. + /// The ID of the dependency. + /// The dependency resource type. + /// The dependency resource name. + internal Dependency(IReadOnlyList dependsOn, string id, string resourceType, string resourceName) + { + DependsOn = dependsOn; + Id = id; + ResourceType = resourceType; + ResourceName = resourceName; + } + + /// The list of dependencies. + public IReadOnlyList DependsOn { get; } + /// The ID of the dependency. + public string Id { get; } + /// The dependency resource type. + public string ResourceType { get; } + /// The dependency resource name. + public string ResourceName { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Deployment.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Deployment.Serialization.cs similarity index 92% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Deployment.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Deployment.Serialization.cs index c0a1e4de0c3a..775df733d9b8 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Deployment.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Deployment.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class Deployment : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Deployment.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Deployment.cs similarity index 94% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Deployment.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Deployment.cs index c26e38f6c523..04d6f51eb1e8 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Deployment.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Deployment.cs @@ -7,7 +7,7 @@ using System; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Deployment operation parameters. public partial class Deployment diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExportResult.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExportResult.Serialization.cs new file mode 100644 index 000000000000..d734dbeb4a08 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExportResult.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class DeploymentExportResult + { + internal static DeploymentExportResult DeserializeDeploymentExportResult(JsonElement element) + { + object template = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("template")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + template = property.Value.GetObject(); + continue; + } + } + return new DeploymentExportResult(template); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExportResult.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExportResult.cs new file mode 100644 index 000000000000..a26c248cd399 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExportResult.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The deployment export result. + public partial class DeploymentExportResult + { + /// Initializes a new instance of DeploymentExportResult. + internal DeploymentExportResult() + { + } + + /// Initializes a new instance of DeploymentExportResult. + /// The template content. + internal DeploymentExportResult(object template) + { + Template = template; + } + + /// The template content. + public object Template { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExtended.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExtended.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExtended.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExtended.Serialization.cs index 3c4c44095f6b..39b8de097908 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExtended.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExtended.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class DeploymentExtended { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExtended.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExtended.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExtended.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExtended.cs index 53d49e73b376..bf61843cef8d 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentExtended.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExtended.cs @@ -7,7 +7,7 @@ using System; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Deployment information. public partial class DeploymentExtended diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExtendedFilter.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExtendedFilter.cs new file mode 100644 index 000000000000..ed4f3c959f0f --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentExtendedFilter.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Deployment filter. + internal partial class DeploymentExtendedFilter + { + /// Initializes a new instance of DeploymentExtendedFilter. + internal DeploymentExtendedFilter() + { + } + + /// Initializes a new instance of DeploymentExtendedFilter. + /// The provisioning state. + internal DeploymentExtendedFilter(string provisioningState) + { + ProvisioningState = provisioningState; + } + + /// The provisioning state. + public string ProvisioningState { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentListResult.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentListResult.Serialization.cs new file mode 100644 index 000000000000..fe724488c1d5 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class DeploymentListResult + { + internal static DeploymentListResult DeserializeDeploymentListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(DeploymentExtended.DeserializeDeploymentExtended(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new DeploymentListResult(value, nextLink); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentListResult.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentListResult.cs new file mode 100644 index 000000000000..78b18e25d026 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// List of deployments. + public partial class DeploymentListResult + { + /// Initializes a new instance of DeploymentListResult. + internal DeploymentListResult() + { + } + + /// Initializes a new instance of DeploymentListResult. + /// An array of deployments. + /// The URL to use for getting the next set of results. + internal DeploymentListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of deployments. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentMode.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentMode.Serialization.cs new file mode 100644 index 000000000000..ac96c28fe784 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentMode.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + internal static class DeploymentModeExtensions + { + public static string ToSerialString(this DeploymentMode value) => value switch + { + DeploymentMode.Incremental => "Incremental", + DeploymentMode.Complete => "Complete", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DeploymentMode value.") + }; + + public static DeploymentMode ToDeploymentMode(this string value) + { + if (string.Equals(value, "Incremental", StringComparison.InvariantCultureIgnoreCase)) return DeploymentMode.Incremental; + if (string.Equals(value, "Complete", StringComparison.InvariantCultureIgnoreCase)) return DeploymentMode.Complete; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DeploymentMode value."); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentMode.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentMode.cs new file mode 100644 index 000000000000..afdf2666a3d4 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentMode.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + public enum DeploymentMode + { + /// Incremental. + Incremental, + /// Complete. + Complete + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperation.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperation.Serialization.cs new file mode 100644 index 000000000000..3557a7305dc0 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperation.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.Management.Resources.Models +{ + public partial class DeploymentOperation + { + internal static DeploymentOperation DeserializeDeploymentOperation(JsonElement element) + { + string id = default; + string operationId = default; + DeploymentOperationProperties properties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + operationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DeploymentOperationProperties.DeserializeDeploymentOperationProperties(property.Value); + continue; + } + } + return new DeploymentOperation(id, operationId, properties); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperation.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperation.cs new file mode 100644 index 000000000000..9732b34a36ef --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperation.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Deployment operation information. + public partial class DeploymentOperation + { + /// Initializes a new instance of DeploymentOperation. + internal DeploymentOperation() + { + } + + /// Initializes a new instance of DeploymentOperation. + /// Full deployment operation ID. + /// Deployment operation ID. + /// Deployment properties. + internal DeploymentOperation(string id, string operationId, DeploymentOperationProperties properties) + { + Id = id; + OperationId = operationId; + Properties = properties; + } + + /// Full deployment operation ID. + public string Id { get; } + /// Deployment operation ID. + public string OperationId { get; } + /// Deployment properties. + public DeploymentOperationProperties Properties { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperationProperties.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperationProperties.Serialization.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperationProperties.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperationProperties.Serialization.cs index 8c790eab3253..6756a6d188fc 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperationProperties.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperationProperties.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class DeploymentOperationProperties { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperationProperties.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperationProperties.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperationProperties.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperationProperties.cs index 59eff7f69b37..45cc9f769f85 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentOperationProperties.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperationProperties.cs @@ -7,7 +7,7 @@ using System; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Deployment operation properties. public partial class DeploymentOperationProperties diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperationsListResult.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperationsListResult.Serialization.cs new file mode 100644 index 000000000000..cf43cdd28335 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperationsListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class DeploymentOperationsListResult + { + internal static DeploymentOperationsListResult DeserializeDeploymentOperationsListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(DeploymentOperation.DeserializeDeploymentOperation(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new DeploymentOperationsListResult(value, nextLink); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperationsListResult.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperationsListResult.cs new file mode 100644 index 000000000000..32b59fb928aa --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentOperationsListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// List of deployment operations. + public partial class DeploymentOperationsListResult + { + /// Initializes a new instance of DeploymentOperationsListResult. + internal DeploymentOperationsListResult() + { + } + + /// Initializes a new instance of DeploymentOperationsListResult. + /// An array of deployment operations. + /// The URL to use for getting the next set of results. + internal DeploymentOperationsListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of deployment operations. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentProperties.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentProperties.Serialization.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentProperties.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentProperties.Serialization.cs index 15dc5e3e8d2f..026ed148ad09 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentProperties.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentProperties.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class DeploymentProperties : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentProperties.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentProperties.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentProperties.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentProperties.cs index 5ce71c259b45..ac14743d1ff1 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentProperties.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentProperties.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Deployment properties. public partial class DeploymentProperties diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentPropertiesExtended.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentPropertiesExtended.Serialization.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentPropertiesExtended.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentPropertiesExtended.Serialization.cs index 3ec895460e8d..a23b66de4ee0 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentPropertiesExtended.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentPropertiesExtended.Serialization.cs @@ -10,7 +10,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class DeploymentPropertiesExtended { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentPropertiesExtended.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentPropertiesExtended.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentPropertiesExtended.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentPropertiesExtended.cs index d615e34d44a0..4b15268c8dbe 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentPropertiesExtended.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentPropertiesExtended.cs @@ -8,7 +8,7 @@ using System; using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Deployment properties with additional details. public partial class DeploymentPropertiesExtended diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentValidateResult.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentValidateResult.Serialization.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentValidateResult.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentValidateResult.Serialization.cs index 84ab7a101bca..d32a53626830 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentValidateResult.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentValidateResult.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class DeploymentValidateResult { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentValidateResult.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentValidateResult.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentValidateResult.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentValidateResult.cs index ad38814470ec..4705d569ab1b 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/DeploymentValidateResult.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/DeploymentValidateResult.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Information from validate template deployment response. public partial class DeploymentValidateResult diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs index bdd2be64538f..14a9faf6ad77 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ErrorAdditionalInfo { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ErrorAdditionalInfo.cs similarity index 95% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ErrorAdditionalInfo.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ErrorAdditionalInfo.cs index 2c30b9b9e4b0..1ce5b274e6e2 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ErrorAdditionalInfo.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ErrorAdditionalInfo.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// The resource management error additional info. public partial class ErrorAdditionalInfo diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ErrorResponse.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ErrorResponse.Serialization.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ErrorResponse.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ErrorResponse.Serialization.cs index 4b191a839c98..d86f7608a847 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ErrorResponse.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ErrorResponse.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ErrorResponse { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ErrorResponse.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ErrorResponse.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ErrorResponse.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ErrorResponse.cs index 500b751e13c6..1fd8a9ed2018 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ErrorResponse.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ErrorResponse.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// The resource management error response. public partial class ErrorResponse diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ExportTemplateRequest.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ExportTemplateRequest.Serialization.cs new file mode 100644 index 000000000000..5b24612494e3 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ExportTemplateRequest.Serialization.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ExportTemplateRequest : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Resources != null) + { + writer.WritePropertyName("resources"); + writer.WriteStartArray(); + foreach (var item in Resources) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Options != null) + { + writer.WritePropertyName("options"); + writer.WriteStringValue(Options); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ExportTemplateRequest.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ExportTemplateRequest.cs new file mode 100644 index 000000000000..becc75048e41 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ExportTemplateRequest.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Export resource group template request parameters. + public partial class ExportTemplateRequest + { + /// Initializes a new instance of ExportTemplateRequest. + public ExportTemplateRequest() + { + } + + /// Initializes a new instance of ExportTemplateRequest. + /// The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. + /// The export template options. A CSV-formatted list containing zero or more of the following: 'IncludeParameterDefaultValue', 'IncludeComments', 'SkipResourceNameParameterization', 'SkipAllParameterization'. + internal ExportTemplateRequest(IList resources, string options) + { + Resources = resources; + Options = options; + } + + /// The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. + public IList Resources { get; set; } + /// The export template options. A CSV-formatted list containing zero or more of the following: 'IncludeParameterDefaultValue', 'IncludeComments', 'SkipResourceNameParameterization', 'SkipAllParameterization'. + public string Options { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResource.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResource.Serialization.cs new file mode 100644 index 000000000000..c82bc40814d6 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResource.Serialization.cs @@ -0,0 +1,213 @@ +// 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.Management.Resources.Models +{ + public partial class GenericResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Plan != null) + { + writer.WritePropertyName("plan"); + writer.WriteObjectValue(Plan); + } + if (Properties != null) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + if (Kind != null) + { + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind); + } + if (ManagedBy != null) + { + writer.WritePropertyName("managedBy"); + writer.WriteStringValue(ManagedBy); + } + if (Sku != null) + { + writer.WritePropertyName("sku"); + writer.WriteObjectValue(Sku); + } + if (Identity != null) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + if (Location != null) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static GenericResource DeserializeGenericResource(JsonElement element) + { + Plan plan = default; + object properties = default; + string kind = default; + string managedBy = default; + Sku sku = default; + Identity identity = default; + string id = default; + string name = default; + string type = default; + string location = default; + IDictionary tags = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("plan")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + plan = Plan.DeserializePlan(property.Value); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = property.Value.GetObject(); + continue; + } + if (property.NameEquals("kind")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("managedBy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("sku")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = Sku.DeserializeSku(property.Value); + continue; + } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = Identity.DeserializeIdentity(property.Value); + continue; + } + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + } + return new GenericResource(id, name, type, location, tags, plan, properties, kind, managedBy, sku, identity); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResource.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResource.cs new file mode 100644 index 000000000000..575d9f7e2513 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResource.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Resource information. + public partial class GenericResource : Resource + { + /// Initializes a new instance of GenericResource. + public GenericResource() + { + } + + /// Initializes a new instance of GenericResource. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// The plan of the resource. + /// The resource properties. + /// The kind of the resource. + /// ID of the resource that manages this resource. + /// The SKU of the resource. + /// The identity of the resource. + internal GenericResource(string id, string name, string type, string location, IDictionary tags, Plan plan, object properties, string kind, string managedBy, Sku sku, Identity identity) : base(id, name, type, location, tags) + { + Plan = plan; + Properties = properties; + Kind = kind; + ManagedBy = managedBy; + Sku = sku; + Identity = identity; + } + + /// The plan of the resource. + public Plan Plan { get; set; } + /// The resource properties. + public object Properties { get; set; } + /// The kind of the resource. + public string Kind { get; set; } + /// ID of the resource that manages this resource. + public string ManagedBy { get; set; } + /// The SKU of the resource. + public Sku Sku { get; set; } + /// The identity of the resource. + public Identity Identity { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResourceExpanded.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResourceExpanded.Serialization.cs new file mode 100644 index 000000000000..f86f445768b2 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResourceExpanded.Serialization.cs @@ -0,0 +1,259 @@ +// 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; + +namespace Azure.Management.Resources.Models +{ + public partial class GenericResourceExpanded : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (CreatedTime != null) + { + writer.WritePropertyName("createdTime"); + writer.WriteStringValue(CreatedTime.Value, "O"); + } + if (ChangedTime != null) + { + writer.WritePropertyName("changedTime"); + writer.WriteStringValue(ChangedTime.Value, "O"); + } + if (ProvisioningState != null) + { + writer.WritePropertyName("provisioningState"); + writer.WriteStringValue(ProvisioningState); + } + if (Plan != null) + { + writer.WritePropertyName("plan"); + writer.WriteObjectValue(Plan); + } + if (Properties != null) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + if (Kind != null) + { + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind); + } + if (ManagedBy != null) + { + writer.WritePropertyName("managedBy"); + writer.WriteStringValue(ManagedBy); + } + if (Sku != null) + { + writer.WritePropertyName("sku"); + writer.WriteObjectValue(Sku); + } + if (Identity != null) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + if (Location != null) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static GenericResourceExpanded DeserializeGenericResourceExpanded(JsonElement element) + { + DateTimeOffset? createdTime = default; + DateTimeOffset? changedTime = default; + string provisioningState = default; + Plan plan = default; + object properties = default; + string kind = default; + string managedBy = default; + Sku sku = default; + Identity identity = default; + string id = default; + string name = default; + string type = default; + string location = default; + IDictionary tags = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("createdTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("changedTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + changedTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = property.Value.GetString(); + continue; + } + if (property.NameEquals("plan")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + plan = Plan.DeserializePlan(property.Value); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = property.Value.GetObject(); + continue; + } + if (property.NameEquals("kind")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("managedBy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("sku")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = Sku.DeserializeSku(property.Value); + continue; + } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = Identity.DeserializeIdentity(property.Value); + continue; + } + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + } + return new GenericResourceExpanded(id, name, type, location, tags, plan, properties, kind, managedBy, sku, identity, createdTime, changedTime, provisioningState); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResourceExpanded.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResourceExpanded.cs new file mode 100644 index 000000000000..83a3db87f10f --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResourceExpanded.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Resource information. + public partial class GenericResourceExpanded : GenericResource + { + /// Initializes a new instance of GenericResourceExpanded. + public GenericResourceExpanded() + { + } + + /// Initializes a new instance of GenericResourceExpanded. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// The plan of the resource. + /// The resource properties. + /// The kind of the resource. + /// ID of the resource that manages this resource. + /// The SKU of the resource. + /// The identity of the resource. + /// The created time of the resource. This is only present if requested via the $expand query parameter. + /// The changed time of the resource. This is only present if requested via the $expand query parameter. + /// The provisioning state of the resource. This is only present if requested via the $expand query parameter. + internal GenericResourceExpanded(string id, string name, string type, string location, IDictionary tags, Plan plan, object properties, string kind, string managedBy, Sku sku, Identity identity, DateTimeOffset? createdTime, DateTimeOffset? changedTime, string provisioningState) : base(id, name, type, location, tags, plan, properties, kind, managedBy, sku, identity) + { + CreatedTime = createdTime; + ChangedTime = changedTime; + ProvisioningState = provisioningState; + } + + /// The created time of the resource. This is only present if requested via the $expand query parameter. + public DateTimeOffset? CreatedTime { get; } + /// The changed time of the resource. This is only present if requested via the $expand query parameter. + public DateTimeOffset? ChangedTime { get; } + /// The provisioning state of the resource. This is only present if requested via the $expand query parameter. + public string ProvisioningState { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResourceFilter.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResourceFilter.cs new file mode 100644 index 000000000000..291512c8bde2 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/GenericResourceFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Resource filter. + internal partial class GenericResourceFilter + { + /// Initializes a new instance of GenericResourceFilter. + internal GenericResourceFilter() + { + } + + /// Initializes a new instance of GenericResourceFilter. + /// The resource type. + /// The tag name. + /// The tag value. + internal GenericResourceFilter(string resourceType, string tagname, string tagvalue) + { + ResourceType = resourceType; + Tagname = tagname; + Tagvalue = tagvalue; + } + + /// The resource type. + public string ResourceType { get; set; } + /// The tag name. + public string Tagname { get; set; } + /// The tag value. + public string Tagvalue { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/HttpMessage.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/HttpMessage.Serialization.cs new file mode 100644 index 000000000000..ea6e0a352373 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/HttpMessage.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class HttpMessage + { + internal static HttpMessage DeserializeHttpMessage(JsonElement element) + { + object content = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("content")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + content = property.Value.GetObject(); + continue; + } + } + return new HttpMessage(content); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/HttpMessage.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/HttpMessage.cs new file mode 100644 index 000000000000..4e5437397eab --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/HttpMessage.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// HTTP message. + public partial class HttpMessage + { + /// Initializes a new instance of HttpMessage. + internal HttpMessage() + { + } + + /// Initializes a new instance of HttpMessage. + /// HTTP message content. + internal HttpMessage(object content) + { + Content = content; + } + + /// HTTP message content. + public object Content { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Identity.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Identity.Serialization.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Identity.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Identity.Serialization.cs index b3f46cb74faf..6114e3c4fb87 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Identity.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Identity.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class Identity : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Identity.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Identity.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Identity.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Identity.cs index d4c67b93f933..6b0443841483 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Identity.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Identity.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Identity for the resource. public partial class Identity diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ParametersLink.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ParametersLink.Serialization.cs new file mode 100644 index 000000000000..b392137ef904 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ParametersLink.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ParametersLink : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("uri"); + writer.WriteStringValue(Uri); + if (ContentVersion != null) + { + writer.WritePropertyName("contentVersion"); + writer.WriteStringValue(ContentVersion); + } + writer.WriteEndObject(); + } + + internal static ParametersLink DeserializeParametersLink(JsonElement element) + { + string uri = default; + string contentVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uri")) + { + uri = property.Value.GetString(); + continue; + } + if (property.NameEquals("contentVersion")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + contentVersion = property.Value.GetString(); + continue; + } + } + return new ParametersLink(uri, contentVersion); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ParametersLink.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ParametersLink.cs new file mode 100644 index 000000000000..4fe84c1daced --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ParametersLink.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// Entity representing the reference to the deployment parameters. + public partial class ParametersLink + { + /// Initializes a new instance of ParametersLink. + /// The URI of the parameters file. + public ParametersLink(string uri) + { + if (uri == null) + { + throw new ArgumentNullException(nameof(uri)); + } + + Uri = uri; + } + + /// Initializes a new instance of ParametersLink. + /// The URI of the parameters file. + /// If included, must match the ContentVersion in the template. + internal ParametersLink(string uri, string contentVersion) + { + Uri = uri; + ContentVersion = contentVersion; + } + + /// The URI of the parameters file. + public string Uri { get; set; } + /// If included, must match the ContentVersion in the template. + public string ContentVersion { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Plan.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Plan.Serialization.cs new file mode 100644 index 000000000000..7f06910a94b9 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Plan.Serialization.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class Plan : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Publisher != null) + { + writer.WritePropertyName("publisher"); + writer.WriteStringValue(Publisher); + } + if (Product != null) + { + writer.WritePropertyName("product"); + writer.WriteStringValue(Product); + } + if (PromotionCode != null) + { + writer.WritePropertyName("promotionCode"); + writer.WriteStringValue(PromotionCode); + } + if (Version != null) + { + writer.WritePropertyName("version"); + writer.WriteStringValue(Version); + } + writer.WriteEndObject(); + } + + internal static Plan DeserializePlan(JsonElement element) + { + string name = default; + string publisher = default; + string product = default; + string promotionCode = default; + string version = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisher")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisher = property.Value.GetString(); + continue; + } + if (property.NameEquals("product")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + product = property.Value.GetString(); + continue; + } + if (property.NameEquals("promotionCode")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + promotionCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("version")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + version = property.Value.GetString(); + continue; + } + } + return new Plan(name, publisher, product, promotionCode, version); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Plan.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Plan.cs new file mode 100644 index 000000000000..08a32248ffc6 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Plan.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Plan for the resource. + public partial class Plan + { + /// Initializes a new instance of Plan. + public Plan() + { + } + + /// Initializes a new instance of Plan. + /// The plan ID. + /// The publisher ID. + /// The offer ID. + /// The promotion code. + /// The plan's version. + internal Plan(string name, string publisher, string product, string promotionCode, string version) + { + Name = name; + Publisher = publisher; + Product = product; + PromotionCode = promotionCode; + Version = version; + } + + /// The plan ID. + public string Name { get; set; } + /// The publisher ID. + public string Publisher { get; set; } + /// The offer ID. + public string Product { get; set; } + /// The promotion code. + public string PromotionCode { get; set; } + /// The plan's version. + public string Version { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Provider.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Provider.Serialization.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Provider.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Provider.Serialization.cs index 337bade2c5dc..ac23501bf5b3 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Provider.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Provider.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class Provider { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Provider.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Provider.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Provider.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Provider.cs index ad9981ae8c4a..6138bc4dd38e 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Provider.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Provider.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Resource provider information. public partial class Provider diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ProviderListResult.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ProviderListResult.Serialization.cs new file mode 100644 index 000000000000..56132ebfde7b --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ProviderListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class ProviderListResult + { + internal static ProviderListResult DeserializeProviderListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(Provider.DeserializeProvider(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new ProviderListResult(value, nextLink); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ProviderListResult.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ProviderListResult.cs new file mode 100644 index 000000000000..ac62a88485f2 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ProviderListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// List of resource providers. + public partial class ProviderListResult + { + /// Initializes a new instance of ProviderListResult. + internal ProviderListResult() + { + } + + /// Initializes a new instance of ProviderListResult. + /// An array of resource providers. + /// The URL to use for getting the next set of results. + internal ProviderListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of resource providers. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ProviderResourceType.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ProviderResourceType.Serialization.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ProviderResourceType.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ProviderResourceType.Serialization.cs index 1e497724c39c..29bba5f7ae99 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ProviderResourceType.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ProviderResourceType.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ProviderResourceType { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ProviderResourceType.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ProviderResourceType.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ProviderResourceType.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ProviderResourceType.cs index 3aabfea3279b..c3b44011747b 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ProviderResourceType.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ProviderResourceType.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Resource type managed by the resource provider. public partial class ProviderResourceType diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Resource.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Resource.Serialization.cs new file mode 100644 index 000000000000..a7c1409899bb --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Resource.Serialization.cs @@ -0,0 +1,123 @@ +// 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.Management.Resources.Models +{ + public partial class Resource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Id != null) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Type != null) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + if (Location != null) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static Resource DeserializeResource(JsonElement element) + { + string id = default; + string name = default; + string type = default; + string location = default; + IDictionary tags = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + } + return new Resource(id, name, type, location, tags); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Resource.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Resource.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Resource.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Resource.cs index b34814f30aa3..cd75bef0ae42 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/Resource.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Resource.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Basic set of the resource properties. public partial class Resource diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroup.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroup.Serialization.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroup.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroup.Serialization.cs index 1b9c08e91601..8c4c7a6c7397 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroup.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroup.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ResourceGroup : IUtf8JsonSerializable { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroup.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroup.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroup.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroup.cs index eaa6635fc5c3..79230bec1402 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroup.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroup.cs @@ -8,7 +8,7 @@ using System; using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Resource group information. public partial class ResourceGroup diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupExportResult.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupExportResult.Serialization.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupExportResult.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupExportResult.Serialization.cs index 74f59f04ef12..1cdc6728b7ce 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupExportResult.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupExportResult.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ResourceGroupExportResult { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupExportResult.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupExportResult.cs similarity index 95% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupExportResult.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupExportResult.cs index 1235a08c28e1..7e5e6b45f84f 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceGroupExportResult.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupExportResult.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Resource group export result. public partial class ResourceGroupExportResult diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupFilter.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupFilter.cs new file mode 100644 index 000000000000..5430a9dab735 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupFilter.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Resource group filter. + internal partial class ResourceGroupFilter + { + /// Initializes a new instance of ResourceGroupFilter. + internal ResourceGroupFilter() + { + } + + /// Initializes a new instance of ResourceGroupFilter. + /// The tag name. + /// The tag value. + internal ResourceGroupFilter(string tagName, string tagValue) + { + TagName = tagName; + TagValue = tagValue; + } + + /// The tag name. + public string TagName { get; set; } + /// The tag value. + public string TagValue { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupListResult.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupListResult.Serialization.cs new file mode 100644 index 000000000000..d0354b68e5ed --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class ResourceGroupListResult + { + internal static ResourceGroupListResult DeserializeResourceGroupListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ResourceGroup.DeserializeResourceGroup(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new ResourceGroupListResult(value, nextLink); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupListResult.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupListResult.cs new file mode 100644 index 000000000000..83aa76231de6 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// List of resource groups. + public partial class ResourceGroupListResult + { + /// Initializes a new instance of ResourceGroupListResult. + internal ResourceGroupListResult() + { + } + + /// Initializes a new instance of ResourceGroupListResult. + /// An array of resource groups. + /// The URL to use for getting the next set of results. + internal ResourceGroupListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of resource groups. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupPatchable.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupPatchable.Serialization.cs new file mode 100644 index 000000000000..3f5fccd2019d --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupPatchable.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.Management.Resources.Models +{ + public partial class ResourceGroupPatchable : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Properties != null) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + if (ManagedBy != null) + { + writer.WritePropertyName("managedBy"); + writer.WriteStringValue(ManagedBy); + } + if (Tags != null) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupPatchable.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupPatchable.cs new file mode 100644 index 000000000000..6b65eb119239 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupPatchable.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Resource group information. + public partial class ResourceGroupPatchable + { + /// Initializes a new instance of ResourceGroupPatchable. + public ResourceGroupPatchable() + { + } + + /// Initializes a new instance of ResourceGroupPatchable. + /// The name of the resource group. + /// The resource group properties. + /// The ID of the resource that manages this resource group. + /// The tags attached to the resource group. + internal ResourceGroupPatchable(string name, ResourceGroupProperties properties, string managedBy, IDictionary tags) + { + Name = name; + Properties = properties; + ManagedBy = managedBy; + Tags = tags; + } + + /// The name of the resource group. + public string Name { get; set; } + /// The resource group properties. + public ResourceGroupProperties Properties { get; set; } + /// The ID of the resource that manages this resource group. + public string ManagedBy { get; set; } + /// The tags attached to the resource group. + public IDictionary Tags { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupProperties.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupProperties.Serialization.cs new file mode 100644 index 000000000000..4046e3c42dd0 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupProperties.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ResourceGroupProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (ProvisioningState != null) + { + writer.WritePropertyName("provisioningState"); + writer.WriteStringValue(ProvisioningState); + } + writer.WriteEndObject(); + } + + internal static ResourceGroupProperties DeserializeResourceGroupProperties(JsonElement element) + { + string provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = property.Value.GetString(); + continue; + } + } + return new ResourceGroupProperties(provisioningState); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupProperties.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupProperties.cs new file mode 100644 index 000000000000..d6f128cc7956 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceGroupProperties.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// The resource group properties. + public partial class ResourceGroupProperties + { + /// Initializes a new instance of ResourceGroupProperties. + public ResourceGroupProperties() + { + } + + /// Initializes a new instance of ResourceGroupProperties. + /// The provisioning state. + internal ResourceGroupProperties(string provisioningState) + { + ProvisioningState = provisioningState; + } + + /// The provisioning state. + public string ProvisioningState { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceListResult.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceListResult.Serialization.cs new file mode 100644 index 000000000000..10ad4eb16849 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class ResourceListResult + { + internal static ResourceListResult DeserializeResourceListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(GenericResourceExpanded.DeserializeGenericResourceExpanded(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new ResourceListResult(value, nextLink); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceListResult.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceListResult.cs new file mode 100644 index 000000000000..2bb0a77049be --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// List of resource groups. + public partial class ResourceListResult + { + /// Initializes a new instance of ResourceListResult. + internal ResourceListResult() + { + } + + /// Initializes a new instance of ResourceListResult. + /// An array of resources. + /// The URL to use for getting the next set of results. + internal ResourceListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of resources. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceManagementErrorWithDetails.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceManagementErrorWithDetails.Serialization.cs similarity index 98% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceManagementErrorWithDetails.Serialization.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceManagementErrorWithDetails.Serialization.cs index d0c5a6377ddf..8d7b52416f3c 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceManagementErrorWithDetails.Serialization.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceManagementErrorWithDetails.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { public partial class ResourceManagementErrorWithDetails { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceManagementErrorWithDetails.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceManagementErrorWithDetails.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceManagementErrorWithDetails.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceManagementErrorWithDetails.cs index 3049af1ea319..55845a57a83a 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceManagementErrorWithDetails.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceManagementErrorWithDetails.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// The detailed error message of resource management. public partial class ResourceManagementErrorWithDetails diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceProviderOperationDisplayProperties.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceProviderOperationDisplayProperties.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceProviderOperationDisplayProperties.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceProviderOperationDisplayProperties.cs index d711d150c5d3..77ff8b082585 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/ResourceProviderOperationDisplayProperties.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourceProviderOperationDisplayProperties.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Resource provider operation's display properties. internal partial class ResourceProviderOperationDisplayProperties diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourcesMoveInfo.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourcesMoveInfo.Serialization.cs new file mode 100644 index 000000000000..2daacc07e45c --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourcesMoveInfo.Serialization.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class ResourcesMoveInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Resources != null) + { + writer.WritePropertyName("resources"); + writer.WriteStartArray(); + foreach (var item in Resources) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (TargetResourceGroup != null) + { + writer.WritePropertyName("targetResourceGroup"); + writer.WriteStringValue(TargetResourceGroup); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourcesMoveInfo.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourcesMoveInfo.cs new file mode 100644 index 000000000000..56dc7259460c --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/ResourcesMoveInfo.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// Parameters of move resources. + public partial class ResourcesMoveInfo + { + /// Initializes a new instance of ResourcesMoveInfo. + public ResourcesMoveInfo() + { + } + + /// Initializes a new instance of ResourcesMoveInfo. + /// The IDs of the resources. + /// The target resource group. + internal ResourcesMoveInfo(IList resources, string targetResourceGroup) + { + Resources = resources; + TargetResourceGroup = targetResourceGroup; + } + + /// The IDs of the resources. + public IList Resources { get; set; } + /// The target resource group. + public string TargetResourceGroup { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Sku.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Sku.Serialization.cs new file mode 100644 index 000000000000..0cf8a09421c3 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Sku.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; + +namespace Azure.Management.Resources.Models +{ + public partial class Sku : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Tier != null) + { + writer.WritePropertyName("tier"); + writer.WriteStringValue(Tier); + } + if (Size != null) + { + writer.WritePropertyName("size"); + writer.WriteStringValue(Size); + } + if (Family != null) + { + writer.WritePropertyName("family"); + writer.WriteStringValue(Family); + } + if (Model != null) + { + writer.WritePropertyName("model"); + writer.WriteStringValue(Model); + } + if (Capacity != null) + { + writer.WritePropertyName("capacity"); + writer.WriteNumberValue(Capacity.Value); + } + writer.WriteEndObject(); + } + + internal static Sku DeserializeSku(JsonElement element) + { + string name = default; + string tier = default; + string size = default; + string family = default; + string model = default; + int? capacity = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("tier")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tier = property.Value.GetString(); + continue; + } + if (property.NameEquals("size")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + size = property.Value.GetString(); + continue; + } + if (property.NameEquals("family")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + family = property.Value.GetString(); + continue; + } + if (property.NameEquals("model")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + model = property.Value.GetString(); + continue; + } + if (property.NameEquals("capacity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacity = property.Value.GetInt32(); + continue; + } + } + return new Sku(name, tier, size, family, model, capacity); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Sku.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Sku.cs new file mode 100644 index 000000000000..684f70b0c2ce --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/Sku.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// SKU for the resource. + public partial class Sku + { + /// Initializes a new instance of Sku. + public Sku() + { + } + + /// Initializes a new instance of Sku. + /// The SKU name. + /// The SKU tier. + /// The SKU size. + /// The SKU family. + /// The SKU model. + /// The SKU capacity. + internal Sku(string name, string tier, string size, string family, string model, int? capacity) + { + Name = name; + Tier = tier; + Size = size; + Family = family; + Model = model; + Capacity = capacity; + } + + /// The SKU name. + public string Name { get; set; } + /// The SKU tier. + public string Tier { get; set; } + /// The SKU size. + public string Size { get; set; } + /// The SKU family. + public string Family { get; set; } + /// The SKU model. + public string Model { get; set; } + /// The SKU capacity. + public int? Capacity { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/SubResource.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/SubResource.cs new file mode 100644 index 000000000000..c351cf71769b --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/SubResource.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Sub-resource. + internal partial class SubResource + { + /// Initializes a new instance of SubResource. + internal SubResource() + { + } + + /// Initializes a new instance of SubResource. + /// Resource ID. + internal SubResource(string id) + { + Id = id; + } + + /// Resource ID. + public string Id { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagCount.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagCount.Serialization.cs new file mode 100644 index 000000000000..41cf87bdf3ba --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagCount.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class TagCount + { + internal static TagCount DeserializeTagCount(JsonElement element) + { + string type = default; + int? value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetInt32(); + continue; + } + } + return new TagCount(type, value); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagCount.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagCount.cs new file mode 100644 index 000000000000..d255e0e3206b --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagCount.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Tag count. + public partial class TagCount + { + /// Initializes a new instance of TagCount. + internal TagCount() + { + } + + /// Initializes a new instance of TagCount. + /// Type of count. + /// Value of count. + internal TagCount(string type, int? value) + { + Type = type; + Value = value; + } + + /// Type of count. + public string Type { get; } + /// Value of count. + public int? Value { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagDetails.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagDetails.Serialization.cs new file mode 100644 index 000000000000..0d1bbbcef287 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagDetails.Serialization.cs @@ -0,0 +1,76 @@ +// 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.Management.Resources.Models +{ + public partial class TagDetails + { + internal static TagDetails DeserializeTagDetails(JsonElement element) + { + string id = default; + string tagName = default; + TagCount count = default; + IReadOnlyList values = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("tagName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tagName = property.Value.GetString(); + continue; + } + if (property.NameEquals("count")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = TagCount.DeserializeTagCount(property.Value); + continue; + } + if (property.NameEquals("values")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(TagValue.DeserializeTagValue(item)); + } + } + values = array; + continue; + } + } + return new TagDetails(id, tagName, count, values); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagDetails.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagDetails.cs similarity index 97% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagDetails.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagDetails.cs index 2e84431ddf2b..cac863ba4d90 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagDetails.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagDetails.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Tag details. public partial class TagDetails diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagValue.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagValue.Serialization.cs new file mode 100644 index 000000000000..94a50bf4d89c --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagValue.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.Management.Resources.Models +{ + public partial class TagValue + { + internal static TagValue DeserializeTagValue(JsonElement element) + { + string id = default; + string tagValue = default; + TagCount count = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("tagValue")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tagValue = property.Value.GetString(); + continue; + } + if (property.NameEquals("count")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = TagCount.DeserializeTagCount(property.Value); + continue; + } + } + return new TagValue(id, tagValue, count); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagValue.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagValue.cs similarity index 96% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagValue.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagValue.cs index bbc055d09801..140460cfbff9 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/Models/TagValue.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagValue.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Management.Resource.Models +namespace Azure.Management.Resources.Models { /// Tag information. public partial class TagValue diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagsListResult.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagsListResult.Serialization.cs new file mode 100644 index 000000000000..5c37cff79aef --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagsListResult.Serialization.cs @@ -0,0 +1,56 @@ +// 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.Management.Resources.Models +{ + public partial class TagsListResult + { + internal static TagsListResult DeserializeTagsListResult(JsonElement element) + { + IReadOnlyList value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(TagDetails.DeserializeTagDetails(item)); + } + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = property.Value.GetString(); + continue; + } + } + return new TagsListResult(value, nextLink); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagsListResult.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagsListResult.cs new file mode 100644 index 000000000000..8f8ecdebe440 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TagsListResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Management.Resources.Models +{ + /// List of subscription tags. + public partial class TagsListResult + { + /// Initializes a new instance of TagsListResult. + internal TagsListResult() + { + } + + /// Initializes a new instance of TagsListResult. + /// An array of tags. + /// The URL to use for getting the next set of results. + internal TagsListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of tags. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TargetResource.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TargetResource.Serialization.cs new file mode 100644 index 000000000000..d3df68e482f1 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TargetResource.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.Management.Resources.Models +{ + public partial class TargetResource + { + internal static TargetResource DeserializeTargetResource(JsonElement element) + { + string id = default; + string resourceName = default; + string resourceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = property.Value.GetString(); + continue; + } + } + return new TargetResource(id, resourceName, resourceType); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TargetResource.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TargetResource.cs new file mode 100644 index 000000000000..7d5b2c5dac39 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TargetResource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Target resource. + public partial class TargetResource + { + /// Initializes a new instance of TargetResource. + internal TargetResource() + { + } + + /// Initializes a new instance of TargetResource. + /// The ID of the resource. + /// The name of the resource. + /// The type of the resource. + internal TargetResource(string id, string resourceName, string resourceType) + { + Id = id; + ResourceName = resourceName; + ResourceType = resourceType; + } + + /// The ID of the resource. + public string Id { get; } + /// The name of the resource. + public string ResourceName { get; } + /// The type of the resource. + public string ResourceType { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TemplateHashResult.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TemplateHashResult.Serialization.cs new file mode 100644 index 000000000000..857c6fe9fadd --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TemplateHashResult.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class TemplateHashResult + { + internal static TemplateHashResult DeserializeTemplateHashResult(JsonElement element) + { + string minifiedTemplate = default; + string templateHash = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("minifiedTemplate")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minifiedTemplate = property.Value.GetString(); + continue; + } + if (property.NameEquals("templateHash")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateHash = property.Value.GetString(); + continue; + } + } + return new TemplateHashResult(minifiedTemplate, templateHash); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TemplateHashResult.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TemplateHashResult.cs new file mode 100644 index 000000000000..636ef4daf767 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TemplateHashResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Management.Resources.Models +{ + /// Result of the request to calculate template hash. It contains a string of minified template and its hash. + public partial class TemplateHashResult + { + /// Initializes a new instance of TemplateHashResult. + internal TemplateHashResult() + { + } + + /// Initializes a new instance of TemplateHashResult. + /// The minified template string. + /// The template hash. + internal TemplateHashResult(string minifiedTemplate, string templateHash) + { + MinifiedTemplate = minifiedTemplate; + TemplateHash = templateHash; + } + + /// The minified template string. + public string MinifiedTemplate { get; } + /// The template hash. + public string TemplateHash { get; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TemplateLink.Serialization.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TemplateLink.Serialization.cs new file mode 100644 index 000000000000..e6421f142bfa --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TemplateLink.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Management.Resources.Models +{ + public partial class TemplateLink : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("uri"); + writer.WriteStringValue(Uri); + if (ContentVersion != null) + { + writer.WritePropertyName("contentVersion"); + writer.WriteStringValue(ContentVersion); + } + writer.WriteEndObject(); + } + + internal static TemplateLink DeserializeTemplateLink(JsonElement element) + { + string uri = default; + string contentVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uri")) + { + uri = property.Value.GetString(); + continue; + } + if (property.NameEquals("contentVersion")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + contentVersion = property.Value.GetString(); + continue; + } + } + return new TemplateLink(uri, contentVersion); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TemplateLink.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TemplateLink.cs new file mode 100644 index 000000000000..7aa765f94b3f --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/Models/TemplateLink.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Management.Resources.Models +{ + /// Entity representing the reference to the template. + public partial class TemplateLink + { + /// Initializes a new instance of TemplateLink. + /// The URI of the template to deploy. + public TemplateLink(string uri) + { + if (uri == null) + { + throw new ArgumentNullException(nameof(uri)); + } + + Uri = uri; + } + + /// Initializes a new instance of TemplateLink. + /// The URI of the template to deploy. + /// If included, must match the ContentVersion in the template. + internal TemplateLink(string uri, string contentVersion) + { + Uri = uri; + ContentVersion = contentVersion; + } + + /// The URI of the template to deploy. + public string Uri { get; set; } + /// If included, must match the ContentVersion in the template. + public string ContentVersion { get; set; } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ProvidersClient.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ProvidersClient.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ProvidersClient.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ProvidersClient.cs index d9c7826aaf2a..2ac4ccd2b549 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ProvidersClient.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ProvidersClient.cs @@ -11,9 +11,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// The Providers service client. public partial class ProvidersClient diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ProvidersRestClient.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ProvidersRestClient.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ProvidersRestClient.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ProvidersRestClient.cs index dbca19e0ec37..09a7f569c94c 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ProvidersRestClient.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ProvidersRestClient.cs @@ -12,9 +12,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { internal partial class ProvidersRestClient { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceGroupsClient.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourceGroupsClient.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceGroupsClient.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourceGroupsClient.cs index 79faa141e7b4..6cf361b55fd2 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceGroupsClient.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourceGroupsClient.cs @@ -11,9 +11,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// The ResourceGroups service client. public partial class ResourceGroupsClient diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourceGroupsDeleteOperation.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourceGroupsDeleteOperation.cs new file mode 100644 index 000000000000..80a75f19dbc8 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourceGroupsDeleteOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + public partial class ResourceGroupsDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ResourceGroupsDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ResourceGroupsDeleteOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceGroupsRestClient.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourceGroupsRestClient.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceGroupsRestClient.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourceGroupsRestClient.cs index 2fcad445fdda..c53174dbc091 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceGroupsRestClient.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourceGroupsRestClient.cs @@ -12,9 +12,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { internal partial class ResourceGroupsRestClient { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesClient.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesClient.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesClient.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesClient.cs index 28645da13199..5b9639c2fde7 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesClient.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesClient.cs @@ -11,9 +11,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// The Resources service client. public partial class ResourcesClient diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesCreateOrUpdateByIdOperation.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesCreateOrUpdateByIdOperation.cs new file mode 100644 index 000000000000..2f64432d7737 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesCreateOrUpdateByIdOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Create a resource by ID. + public partial class ResourcesCreateOrUpdateByIdOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ResourcesCreateOrUpdateByIdOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ResourcesCreateOrUpdateByIdOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override GenericResource 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); + + GenericResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return GenericResource.DeserializeGenericResource(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return GenericResource.DeserializeGenericResource(document.RootElement); + } + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesCreateOrUpdateOperation.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..70e657082873 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesCreateOrUpdateOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Creates a resource. + public partial class ResourcesCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ResourcesCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ResourcesCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override GenericResource 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); + + GenericResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return GenericResource.DeserializeGenericResource(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return GenericResource.DeserializeGenericResource(document.RootElement); + } + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesDeleteByIdOperation.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesDeleteByIdOperation.cs new file mode 100644 index 000000000000..6b2071327c9a --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesDeleteByIdOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// Deletes a resource by ID. + public partial class ResourcesDeleteByIdOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ResourcesDeleteByIdOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ResourcesDeleteByIdOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesDeleteOperation.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesDeleteOperation.cs new file mode 100644 index 000000000000..9164e13e8c81 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesDeleteOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// Deletes a resource. + public partial class ResourcesDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ResourcesDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ResourcesDeleteOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceManagementClient.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesManagementClient.cs similarity index 77% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceManagementClient.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesManagementClient.cs index ea8992212e2a..71996d9a6bde 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourceManagementClient.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesManagementClient.cs @@ -8,37 +8,37 @@ using System; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource; +using Azure.Management.Resources; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { - /// Resource service management client. - public class ResourceManagementClient + /// Resources service management client. + public class ResourcesManagementClient { private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; private readonly string _subscriptionId; private readonly Uri _endpoint; - /// Initializes a new instance of ResourceManagementClient for mocking. - protected ResourceManagementClient() + /// Initializes a new instance of ResourcesManagementClient for mocking. + protected ResourcesManagementClient() { } - /// Initializes a new instance of ResourceManagementClient. + /// Initializes a new instance of ResourcesManagementClient. /// The ID of the target subscription. /// The OAuth token for making client requests. /// The options for configuring the client. - public ResourceManagementClient(string subscriptionId, TokenCredential tokenCredential, ResourceManagementClientOptions options = null) : this(subscriptionId, null, tokenCredential, options) + public ResourcesManagementClient(string subscriptionId, TokenCredential tokenCredential, ResourcesManagementClientOptions options = null) : this(subscriptionId, null, tokenCredential, options) { } - /// Initializes a new instance of ResourceManagementClient. + /// Initializes a new instance of ResourcesManagementClient. /// The ID of the target subscription. /// server parameter. /// The OAuth token for making client requests. /// The options for configuring the client. /// This occurs when one of the required arguments is null. - public ResourceManagementClient(string subscriptionId, Uri endpoint, TokenCredential tokenCredential, ResourceManagementClientOptions options = null) + public ResourcesManagementClient(string subscriptionId, Uri endpoint, TokenCredential tokenCredential, ResourcesManagementClientOptions options = null) { if (subscriptionId == null) { @@ -46,7 +46,7 @@ public ResourceManagementClient(string subscriptionId, Uri endpoint, TokenCreden } endpoint ??= new Uri("https://management.azure.com"); - options ??= new ResourceManagementClientOptions(); + options ??= new ResourcesManagementClientOptions(); _clientDiagnostics = new ClientDiagnostics(options); _pipeline = ManagementPipelineBuilder.Build(tokenCredential, endpoint, options); _subscriptionId = subscriptionId; diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesManagementClientOptions.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesManagementClientOptions.cs new file mode 100644 index 000000000000..f2e2054e49fa --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesManagementClientOptions.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.Management.Resources +{ + /// Client options for Resources. + public class ResourcesManagementClientOptions : ClientOptions + { + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesMoveResourcesOperation.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesMoveResourcesOperation.cs new file mode 100644 index 000000000000..e0bc9f2a4555 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesMoveResourcesOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + public partial class ResourcesMoveResourcesOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ResourcesMoveResourcesOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ResourcesMoveResourcesOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesRestClient.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesRestClient.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesRestClient.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesRestClient.cs index ff3cb07b8c0a..59f65fbdb6e1 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/ResourcesRestClient.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesRestClient.cs @@ -12,9 +12,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { internal partial class ResourcesRestClient { diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesUpdateByIdOperation.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesUpdateByIdOperation.cs new file mode 100644 index 000000000000..3739cf9ae556 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesUpdateByIdOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Updates a resource by ID. + public partial class ResourcesUpdateByIdOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ResourcesUpdateByIdOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ResourcesUpdateByIdOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override GenericResource 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); + + GenericResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return GenericResource.DeserializeGenericResource(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return GenericResource.DeserializeGenericResource(document.RootElement); + } + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesUpdateOperation.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesUpdateOperation.cs new file mode 100644 index 000000000000..b5147e6b18f7 --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesUpdateOperation.cs @@ -0,0 +1,80 @@ +// 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.Management.Resources.Models; + +namespace Azure.Management.Resources +{ + /// Updates a resource. + public partial class ResourcesUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ResourcesUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ResourcesUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override GenericResource 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); + + GenericResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return GenericResource.DeserializeGenericResource(document.RootElement); + } + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + return null; + } + else + { + return GenericResource.DeserializeGenericResource(document.RootElement); + } + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesValidateMoveResourcesOperation.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesValidateMoveResourcesOperation.cs new file mode 100644 index 000000000000..6b9e6e9c27fb --- /dev/null +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/ResourcesValidateMoveResourcesOperation.cs @@ -0,0 +1,62 @@ +// 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.Management.Resources +{ + /// This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + public partial class ResourcesValidateMoveResourcesOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal ResourcesValidateMoveResourcesOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ResourcesValidateMoveResourcesOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response 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); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/TagsClient.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/TagsClient.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/TagsClient.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/TagsClient.cs index fa0dc87cc599..b4b83cc9073e 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/TagsClient.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/TagsClient.cs @@ -11,9 +11,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { /// The Tags service client. public partial class TagsClient diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/TagsRestClient.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/TagsRestClient.cs similarity index 99% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/TagsRestClient.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/TagsRestClient.cs index 0ff96bf2e20d..5a7968e3cf14 100644 --- a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Generated/TagsRestClient.cs +++ b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Generated/TagsRestClient.cs @@ -12,9 +12,9 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Management.Resource.Models; +using Azure.Management.Resources.Models; -namespace Azure.Management.Resource +namespace Azure.Management.Resources { internal partial class TagsRestClient { diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/Properties/AssemblyInfo.cs b/sdk/testcommon/Azure.Management.Resources.2017_05/src/Properties/AssemblyInfo.cs similarity index 100% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/Properties/AssemblyInfo.cs rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/Properties/AssemblyInfo.cs diff --git a/sdk/testcommon/Azure.Management.Resource.2017_05/src/autorest.md b/sdk/testcommon/Azure.Management.Resources.2017_05/src/autorest.md similarity index 100% rename from sdk/testcommon/Azure.Management.Resource.2017_05/src/autorest.md rename to sdk/testcommon/Azure.Management.Resources.2017_05/src/autorest.md