diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Azure.ResourceManager.CosmosDB.sln b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Azure.ResourceManager.CosmosDB.sln new file mode 100644 index 000000000000..88ed6694f474 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Azure.ResourceManager.CosmosDB.sln @@ -0,0 +1,51 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30309.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{4F57C70B-C02E-4F89-9E79-4579179A66E8}") = "Azure.ResourceManager.CosmosDB", "src\Azure.ResourceManager.CosmosDB.csproj", "{7C8507C6-BFAE-4DD2-B4AD-FE1A49B8E246}" +EndProject +Project("{4F57C70B-C02E-4F89-9E79-4579179A66E8}") = "Azure.ResourceManager.CosmosDB.Tests", "tests\Azure.ResourceManager.CosmosDB.Tests.csproj", "{3EC07824-4ECC-4909-8F2A-4796B3B157C6}" +EndProject +Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {22B5C190-A09C-48DF-A800-D892011143EE} + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7C8507C6-BFAE-4DD2-B4AD-FE1A49B8E246}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7C8507C6-BFAE-4DD2-B4AD-FE1A49B8E246}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7C8507C6-BFAE-4DD2-B4AD-FE1A49B8E246}.Debug|x64.ActiveCfg = Debug|Any CPU + {7C8507C6-BFAE-4DD2-B4AD-FE1A49B8E246}.Debug|x64.Build.0 = Debug|Any CPU + {7C8507C6-BFAE-4DD2-B4AD-FE1A49B8E246}.Debug|x86.ActiveCfg = Debug|Any CPU + {7C8507C6-BFAE-4DD2-B4AD-FE1A49B8E246}.Debug|x86.Build.0 = Debug|Any CPU + {7C8507C6-BFAE-4DD2-B4AD-FE1A49B8E246}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7C8507C6-BFAE-4DD2-B4AD-FE1A49B8E246}.Release|Any CPU.Build.0 = Release|Any CPU + {7C8507C6-BFAE-4DD2-B4AD-FE1A49B8E246}.Release|x64.ActiveCfg = Release|Any CPU + {7C8507C6-BFAE-4DD2-B4AD-FE1A49B8E246}.Release|x64.Build.0 = Release|Any CPU + {7C8507C6-BFAE-4DD2-B4AD-FE1A49B8E246}.Release|x86.ActiveCfg = Release|Any CPU + {7C8507C6-BFAE-4DD2-B4AD-FE1A49B8E246}.Release|x86.Build.0 = Release|Any CPU + {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Debug|x64.ActiveCfg = Debug|Any CPU + {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Debug|x64.Build.0 = Debug|Any CPU + {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Debug|x86.ActiveCfg = Debug|Any CPU + {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Debug|x86.Build.0 = Debug|Any CPU + {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Release|Any CPU.Build.0 = Release|Any CPU + {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Release|x64.ActiveCfg = Release|Any CPU + {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Release|x64.Build.0 = Release|Any CPU + {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Release|x86.ActiveCfg = Release|Any CPU + {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/CHANGELOG.md b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/CHANGELOG.md new file mode 100644 index 000000000000..3d4ff921b5b6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 1.0.0-preview.1 (Unreleased) + +This package follows the [Azure SDK Design Guidelines for .NET](https://azure.github.io/azure-sdk/dotnet_introduction.html) which provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more. + +This is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, please submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). \ No newline at end of file diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Directory.Build.props b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Directory.Build.props new file mode 100644 index 000000000000..1a9611bd4924 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/README.md b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/README.md new file mode 100644 index 000000000000..aeeb1a42d8a8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/README.md @@ -0,0 +1,77 @@ +# Azure CosmosDB Management client library for .NET + +This package follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html) which provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more. + +## Getting started + +### Install the package + +Install the Azure CosmosDB management library for .NET with [NuGet](https://www.nuget.org/): + +```PowerShell +Install-Package Azure.ResourceManager.CosmosDB -Version 1.0.0-preview.1 +``` + +### Prerequisites + +* You must have an [Azure subscription](https://azure.microsoft.com/free/) + +### Authenticate the Client + +To create an authenticated client and start interacting with Azure resources, please see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/master/doc/mgmt_preview_quickstart.md) + +## Key concepts + +Key concepts of the Azure .NET SDK can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html) + +## Documentation + +Documentation is available to help you learn how to use this package + +- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/master/doc/mgmt_preview_quickstart.md) +- [API References](https://docs.microsoft.com/dotnet/api/?view=azure-dotnet) +- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/identity/Azure.Identity/README.md) + +## Examples + +Code samples for using the management library for .NET can be found in the following locations +- [.NET Management Library Code Samples](https://docs.microsoft.com/samples/browse/?branch=master&languages=csharp&term=managing%20using%20Azure%20.NET%20SDK) + +## Troubleshooting + +- File an issue via [Github + Issues](https://github.com/Azure/azure-sdk-for-net/issues) +- Check [previous + questions](https://stackoverflow.com/questions/tagged/azure+.net) + or ask new ones on Stack Overflow using azure and .net tags. + + +## Next steps + +For more information on Azure SDK, please refer to [this website](https://azure.github.io/azure-sdk/) + +## Contributing + +For details on contributing to this repository, see the contributing +guide. + +This project welcomes contributions and suggestions. Most contributions +require you to agree to a Contributor License Agreement (CLA) declaring +that you have the right to, and actually do, grant us the rights to use +your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine +whether you need to provide a CLA and decorate the PR appropriately +(e.g., label, comment). Simply follow the instructions provided by the +bot. You will only need to do this once across all repositories using +our CLA. + +This project has adopted the Microsoft Open Source Code of Conduct. For +more information see the Code of Conduct FAQ or contact + with any additional questions or comments. + + +[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization +[style-guide-cloud]: https://worldready.cloudapp.net/Styleguide/Read?id=2696&topicid=25357 + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Ftemplate%2FAzure.Template%2FREADME.png) \ No newline at end of file diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Azure.ResourceManager.CosmosDB.csproj b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Azure.ResourceManager.CosmosDB.csproj new file mode 100644 index 000000000000..7a9d3671ab38 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Azure.ResourceManager.CosmosDB.csproj @@ -0,0 +1,13 @@ + + + 1.0.0-preview.1 + Azure.ResourceManager.CosmosDB + Azure Resource Manager client SDK for Azure resource provider Microsoft.DocumentDB + azure;management;arm;resource manager;documentdb + + + + + $(NoWarn);AZC0001;CS1591 + + diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesCreateUpdateCassandraKeyspaceOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesCreateUpdateCassandraKeyspaceOperation.cs new file mode 100644 index 000000000000..35045c2efa06 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesCreateUpdateCassandraKeyspaceOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update an Azure Cosmos DB Cassandra keyspace. + public partial class CassandraResourcesCreateUpdateCassandraKeyspaceOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal CassandraResourcesCreateUpdateCassandraKeyspaceOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesCreateUpdateCassandraKeyspaceOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override CassandraKeyspaceGetResults 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); + + CassandraKeyspaceGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return CassandraKeyspaceGetResults.DeserializeCassandraKeyspaceGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return CassandraKeyspaceGetResults.DeserializeCassandraKeyspaceGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesCreateUpdateCassandraTableOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesCreateUpdateCassandraTableOperation.cs new file mode 100644 index 000000000000..26a4c74deae6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesCreateUpdateCassandraTableOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update an Azure Cosmos DB Cassandra Table. + public partial class CassandraResourcesCreateUpdateCassandraTableOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal CassandraResourcesCreateUpdateCassandraTableOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesCreateUpdateCassandraTableOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override CassandraTableGetResults 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); + + CassandraTableGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return CassandraTableGetResults.DeserializeCassandraTableGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return CassandraTableGetResults.DeserializeCassandraTableGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesDeleteCassandraKeyspaceOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesDeleteCassandraKeyspaceOperation.cs new file mode 100644 index 000000000000..ce9540da39db --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesDeleteCassandraKeyspaceOperation.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.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB Cassandra keyspace. + public partial class CassandraResourcesDeleteCassandraKeyspaceOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal CassandraResourcesDeleteCassandraKeyspaceOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesDeleteCassandraKeyspaceOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesDeleteCassandraTableOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesDeleteCassandraTableOperation.cs new file mode 100644 index 000000000000..0ef5615609db --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesDeleteCassandraTableOperation.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.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB Cassandra table. + public partial class CassandraResourcesDeleteCassandraTableOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal CassandraResourcesDeleteCassandraTableOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesDeleteCassandraTableOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraKeyspaceToAutoscaleOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraKeyspaceToAutoscaleOperation.cs new file mode 100644 index 000000000000..710bfd43af54 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraKeyspaceToAutoscaleOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + public partial class CassandraResourcesMigrateCassandraKeyspaceToAutoscaleOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal CassandraResourcesMigrateCassandraKeyspaceToAutoscaleOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesMigrateCassandraKeyspaceToAutoscaleOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraKeyspaceToManualThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraKeyspaceToManualThroughputOperation.cs new file mode 100644 index 000000000000..024cc2e74915 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraKeyspaceToManualThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + public partial class CassandraResourcesMigrateCassandraKeyspaceToManualThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal CassandraResourcesMigrateCassandraKeyspaceToManualThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesMigrateCassandraKeyspaceToManualThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraTableToAutoscaleOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraTableToAutoscaleOperation.cs new file mode 100644 index 000000000000..a2b28a0d7ad6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraTableToAutoscaleOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + public partial class CassandraResourcesMigrateCassandraTableToAutoscaleOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal CassandraResourcesMigrateCassandraTableToAutoscaleOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesMigrateCassandraTableToAutoscaleOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraTableToManualThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraTableToManualThroughputOperation.cs new file mode 100644 index 000000000000..05c5910f2c9e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraTableToManualThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + public partial class CassandraResourcesMigrateCassandraTableToManualThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal CassandraResourcesMigrateCassandraTableToManualThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesMigrateCassandraTableToManualThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesOperations.cs new file mode 100644 index 000000000000..a51fd26d11d4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesOperations.cs @@ -0,0 +1,1140 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The CassandraResources service client. + public partial class CassandraResourcesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal CassandraResourcesRestOperations RestClient { get; } + /// Initializes a new instance of CassandraResourcesOperations for mocking. + protected CassandraResourcesOperations() + { + } + /// Initializes a new instance of CassandraResourcesOperations. + /// 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 CassandraResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new CassandraResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + public virtual async Task> GetCassandraKeyspaceAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.GetCassandraKeyspace"); + scope.Start(); + try + { + return await RestClient.GetCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + public virtual Response GetCassandraKeyspace(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.GetCassandraKeyspace"); + scope.Start(); + try + { + return RestClient.GetCassandraKeyspace(resourceGroupName, accountName, keyspaceName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + public virtual async Task> GetCassandraKeyspaceThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.GetCassandraKeyspaceThroughput"); + scope.Start(); + try + { + return await RestClient.GetCassandraKeyspaceThroughputAsync(resourceGroupName, accountName, keyspaceName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + public virtual Response GetCassandraKeyspaceThroughput(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.GetCassandraKeyspaceThroughput"); + scope.Start(); + try + { + return RestClient.GetCassandraKeyspaceThroughput(resourceGroupName, accountName, keyspaceName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the Cassandra table under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + public virtual async Task> GetCassandraTableAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.GetCassandraTable"); + scope.Start(); + try + { + return await RestClient.GetCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the Cassandra table under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + public virtual Response GetCassandraTable(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.GetCassandraTable"); + scope.Start(); + try + { + return RestClient.GetCassandraTable(resourceGroupName, accountName, keyspaceName, tableName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + public virtual async Task> GetCassandraTableThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.GetCassandraTableThroughput"); + scope.Start(); + try + { + return await RestClient.GetCassandraTableThroughputAsync(resourceGroupName, accountName, keyspaceName, tableName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + public virtual Response GetCassandraTableThroughput(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.GetCassandraTableThroughput"); + scope.Start(); + try + { + return RestClient.GetCassandraTableThroughput(resourceGroupName, accountName, keyspaceName, tableName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListCassandraKeyspacesAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.ListCassandraKeyspaces"); + scope.Start(); + try + { + var response = await RestClient.ListCassandraKeyspacesAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListCassandraKeyspaces(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.ListCassandraKeyspaces"); + scope.Start(); + try + { + var response = RestClient.ListCassandraKeyspaces(resourceGroupName, accountName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Lists the Cassandra table under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListCassandraTablesAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.ListCassandraTables"); + scope.Start(); + try + { + var response = await RestClient.ListCassandraTablesAsync(resourceGroupName, accountName, keyspaceName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the Cassandra table under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListCassandraTables(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.ListCassandraTables"); + scope.Start(); + try + { + var response = RestClient.ListCassandraTables(resourceGroupName, accountName, keyspaceName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Create or update an Azure Cosmos DB Cassandra keyspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The parameters to provide for the current Cassandra keyspace. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateUpdateCassandraKeyspaceAsync(string resourceGroupName, string accountName, string keyspaceName, CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (createUpdateCassandraKeyspaceParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateCassandraKeyspaceParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartCreateUpdateCassandraKeyspace"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesCreateUpdateCassandraKeyspaceOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateCassandraKeyspaceRequest(resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB Cassandra keyspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The parameters to provide for the current Cassandra keyspace. + /// The cancellation token to use. + /// , , , or is null. + public virtual CassandraResourcesCreateUpdateCassandraKeyspaceOperation StartCreateUpdateCassandraKeyspace(string resourceGroupName, string accountName, string keyspaceName, CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (createUpdateCassandraKeyspaceParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateCassandraKeyspaceParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartCreateUpdateCassandraKeyspace"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateCassandraKeyspace(resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters, cancellationToken); + return new CassandraResourcesCreateUpdateCassandraKeyspaceOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateCassandraKeyspaceRequest(resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Cassandra keyspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteCassandraKeyspaceAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartDeleteCassandraKeyspace"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesDeleteCassandraKeyspaceOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteCassandraKeyspaceRequest(resourceGroupName, accountName, keyspaceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Cassandra keyspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public virtual CassandraResourcesDeleteCassandraKeyspaceOperation StartDeleteCassandraKeyspace(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartDeleteCassandraKeyspace"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteCassandraKeyspace(resourceGroupName, accountName, keyspaceName, cancellationToken); + return new CassandraResourcesDeleteCassandraKeyspaceOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteCassandraKeyspaceRequest(resourceGroupName, accountName, keyspaceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The RUs per second of the parameters to provide for the current Cassandra Keyspace. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartUpdateCassandraKeyspaceThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartUpdateCassandraKeyspaceThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateCassandraKeyspaceThroughputAsync(resourceGroupName, accountName, keyspaceName, updateThroughputParameters, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesUpdateCassandraKeyspaceThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateCassandraKeyspaceThroughputRequest(resourceGroupName, accountName, keyspaceName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The RUs per second of the parameters to provide for the current Cassandra Keyspace. + /// The cancellation token to use. + /// , , , or is null. + public virtual CassandraResourcesUpdateCassandraKeyspaceThroughputOperation StartUpdateCassandraKeyspaceThroughput(string resourceGroupName, string accountName, string keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartUpdateCassandraKeyspaceThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.UpdateCassandraKeyspaceThroughput(resourceGroupName, accountName, keyspaceName, updateThroughputParameters, cancellationToken); + return new CassandraResourcesUpdateCassandraKeyspaceThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateCassandraKeyspaceThroughputRequest(resourceGroupName, accountName, keyspaceName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartMigrateCassandraKeyspaceToAutoscaleAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartMigrateCassandraKeyspaceToAutoscale"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateCassandraKeyspaceToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesMigrateCassandraKeyspaceToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateCassandraKeyspaceToAutoscaleRequest(resourceGroupName, accountName, keyspaceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public virtual CassandraResourcesMigrateCassandraKeyspaceToAutoscaleOperation StartMigrateCassandraKeyspaceToAutoscale(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartMigrateCassandraKeyspaceToAutoscale"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateCassandraKeyspaceToAutoscale(resourceGroupName, accountName, keyspaceName, cancellationToken); + return new CassandraResourcesMigrateCassandraKeyspaceToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateCassandraKeyspaceToAutoscaleRequest(resourceGroupName, accountName, keyspaceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartMigrateCassandraKeyspaceToManualThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartMigrateCassandraKeyspaceToManualThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateCassandraKeyspaceToManualThroughputAsync(resourceGroupName, accountName, keyspaceName, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesMigrateCassandraKeyspaceToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateCassandraKeyspaceToManualThroughputRequest(resourceGroupName, accountName, keyspaceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public virtual CassandraResourcesMigrateCassandraKeyspaceToManualThroughputOperation StartMigrateCassandraKeyspaceToManualThroughput(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartMigrateCassandraKeyspaceToManualThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateCassandraKeyspaceToManualThroughput(resourceGroupName, accountName, keyspaceName, cancellationToken); + return new CassandraResourcesMigrateCassandraKeyspaceToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateCassandraKeyspaceToManualThroughputRequest(resourceGroupName, accountName, keyspaceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB Cassandra Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The parameters to provide for the current Cassandra Table. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartCreateUpdateCassandraTableAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (createUpdateCassandraTableParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateCassandraTableParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartCreateUpdateCassandraTable"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesCreateUpdateCassandraTableOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateCassandraTableRequest(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB Cassandra Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The parameters to provide for the current Cassandra Table. + /// The cancellation token to use. + /// , , , , or is null. + public virtual CassandraResourcesCreateUpdateCassandraTableOperation StartCreateUpdateCassandraTable(string resourceGroupName, string accountName, string keyspaceName, string tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (createUpdateCassandraTableParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateCassandraTableParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartCreateUpdateCassandraTable"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateCassandraTable(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters, cancellationToken); + return new CassandraResourcesCreateUpdateCassandraTableOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateCassandraTableRequest(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Cassandra table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartDeleteCassandraTableAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartDeleteCassandraTable"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesDeleteCassandraTableOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteCassandraTableRequest(resourceGroupName, accountName, keyspaceName, tableName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Cassandra table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public virtual CassandraResourcesDeleteCassandraTableOperation StartDeleteCassandraTable(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartDeleteCassandraTable"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteCassandraTable(resourceGroupName, accountName, keyspaceName, tableName, cancellationToken); + return new CassandraResourcesDeleteCassandraTableOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteCassandraTableRequest(resourceGroupName, accountName, keyspaceName, tableName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB Cassandra table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The RUs per second of the parameters to provide for the current Cassandra table. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartUpdateCassandraTableThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartUpdateCassandraTableThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateCassandraTableThroughputAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesUpdateCassandraTableThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateCassandraTableThroughputRequest(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB Cassandra table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The RUs per second of the parameters to provide for the current Cassandra table. + /// The cancellation token to use. + /// , , , , or is null. + public virtual CassandraResourcesUpdateCassandraTableThroughputOperation StartUpdateCassandraTableThroughput(string resourceGroupName, string accountName, string keyspaceName, string tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartUpdateCassandraTableThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.UpdateCassandraTableThroughput(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters, cancellationToken); + return new CassandraResourcesUpdateCassandraTableThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateCassandraTableThroughputRequest(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartMigrateCassandraTableToAutoscaleAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartMigrateCassandraTableToAutoscale"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateCassandraTableToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, tableName, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesMigrateCassandraTableToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateCassandraTableToAutoscaleRequest(resourceGroupName, accountName, keyspaceName, tableName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public virtual CassandraResourcesMigrateCassandraTableToAutoscaleOperation StartMigrateCassandraTableToAutoscale(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartMigrateCassandraTableToAutoscale"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateCassandraTableToAutoscale(resourceGroupName, accountName, keyspaceName, tableName, cancellationToken); + return new CassandraResourcesMigrateCassandraTableToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateCassandraTableToAutoscaleRequest(resourceGroupName, accountName, keyspaceName, tableName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartMigrateCassandraTableToManualThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartMigrateCassandraTableToManualThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateCassandraTableToManualThroughputAsync(resourceGroupName, accountName, keyspaceName, tableName, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesMigrateCassandraTableToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateCassandraTableToManualThroughputRequest(resourceGroupName, accountName, keyspaceName, tableName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public virtual CassandraResourcesMigrateCassandraTableToManualThroughputOperation StartMigrateCassandraTableToManualThroughput(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartMigrateCassandraTableToManualThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateCassandraTableToManualThroughput(resourceGroupName, accountName, keyspaceName, tableName, cancellationToken); + return new CassandraResourcesMigrateCassandraTableToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateCassandraTableToManualThroughputRequest(resourceGroupName, accountName, keyspaceName, tableName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesRestOperations.cs new file mode 100644 index 000000000000..ccc0487513bf --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesRestOperations.cs @@ -0,0 +1,1608 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class CassandraResourcesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of CassandraResourcesRestOperations. + /// 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. + /// is null. + public CassandraResourcesRestOperations(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 HttpMessage CreateListCassandraKeyspacesRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListCassandraKeyspacesAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListCassandraKeyspacesRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CassandraKeyspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CassandraKeyspaceListResult.DeserializeCassandraKeyspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListCassandraKeyspaces(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListCassandraKeyspacesRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CassandraKeyspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CassandraKeyspaceListResult.DeserializeCassandraKeyspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetCassandraKeyspaceRequest(string resourceGroupName, string accountName, string keyspaceName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetCassandraKeyspaceAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateGetCassandraKeyspaceRequest(resourceGroupName, accountName, keyspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CassandraKeyspaceGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CassandraKeyspaceGetResults.DeserializeCassandraKeyspaceGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public Response GetCassandraKeyspace(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateGetCassandraKeyspaceRequest(resourceGroupName, accountName, keyspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CassandraKeyspaceGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CassandraKeyspaceGetResults.DeserializeCassandraKeyspaceGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateCassandraKeyspaceRequest(string resourceGroupName, string accountName, string keyspaceName, CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateCassandraKeyspaceParameters); + request.Content = content; + return message; + } + + /// Create or update an Azure Cosmos DB Cassandra keyspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The parameters to provide for the current Cassandra keyspace. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateUpdateCassandraKeyspaceAsync(string resourceGroupName, string accountName, string keyspaceName, CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (createUpdateCassandraKeyspaceParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateCassandraKeyspaceParameters)); + } + + using var message = CreateCreateUpdateCassandraKeyspaceRequest(resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an Azure Cosmos DB Cassandra keyspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The parameters to provide for the current Cassandra keyspace. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateUpdateCassandraKeyspace(string resourceGroupName, string accountName, string keyspaceName, CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (createUpdateCassandraKeyspaceParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateCassandraKeyspaceParameters)); + } + + using var message = CreateCreateUpdateCassandraKeyspaceRequest(resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteCassandraKeyspaceRequest(string resourceGroupName, string accountName, string keyspaceName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB Cassandra keyspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteCassandraKeyspaceAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateDeleteCassandraKeyspaceRequest(resourceGroupName, accountName, keyspaceName); + 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 an existing Azure Cosmos DB Cassandra keyspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public Response DeleteCassandraKeyspace(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateDeleteCassandraKeyspaceRequest(resourceGroupName, accountName, keyspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetCassandraKeyspaceThroughputRequest(string resourceGroupName, string accountName, string keyspaceName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetCassandraKeyspaceThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateGetCassandraKeyspaceThroughputRequest(resourceGroupName, accountName, keyspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public Response GetCassandraKeyspaceThroughput(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateGetCassandraKeyspaceThroughputRequest(resourceGroupName, accountName, keyspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateCassandraKeyspaceThroughputRequest(string resourceGroupName, string accountName, string keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateThroughputParameters); + request.Content = content; + return message; + } + + /// Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The RUs per second of the parameters to provide for the current Cassandra Keyspace. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateCassandraKeyspaceThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateCassandraKeyspaceThroughputRequest(resourceGroupName, accountName, keyspaceName, updateThroughputParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The RUs per second of the parameters to provide for the current Cassandra Keyspace. + /// The cancellation token to use. + /// , , , or is null. + public Response UpdateCassandraKeyspaceThroughput(string resourceGroupName, string accountName, string keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateCassandraKeyspaceThroughputRequest(resourceGroupName, accountName, keyspaceName, updateThroughputParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateCassandraKeyspaceToAutoscaleRequest(string resourceGroupName, string accountName, string keyspaceName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public async Task MigrateCassandraKeyspaceToAutoscaleAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateMigrateCassandraKeyspaceToAutoscaleRequest(resourceGroupName, accountName, keyspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public Response MigrateCassandraKeyspaceToAutoscale(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateMigrateCassandraKeyspaceToAutoscaleRequest(resourceGroupName, accountName, keyspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateCassandraKeyspaceToManualThroughputRequest(string resourceGroupName, string accountName, string keyspaceName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public async Task MigrateCassandraKeyspaceToManualThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateMigrateCassandraKeyspaceToManualThroughputRequest(resourceGroupName, accountName, keyspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public Response MigrateCassandraKeyspaceToManualThroughput(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateMigrateCassandraKeyspaceToManualThroughputRequest(resourceGroupName, accountName, keyspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListCassandraTablesRequest(string resourceGroupName, string accountName, string keyspaceName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/tables", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the Cassandra table under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListCassandraTablesAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateListCassandraTablesRequest(resourceGroupName, accountName, keyspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CassandraTableListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CassandraTableListResult.DeserializeCassandraTableListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the Cassandra table under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public Response ListCassandraTables(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateListCassandraTablesRequest(resourceGroupName, accountName, keyspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CassandraTableListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CassandraTableListResult.DeserializeCassandraTableListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetCassandraTableRequest(string resourceGroupName, string accountName, string keyspaceName, string tableName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the Cassandra table under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetCassandraTableAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateGetCassandraTableRequest(resourceGroupName, accountName, keyspaceName, tableName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CassandraTableGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CassandraTableGetResults.DeserializeCassandraTableGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the Cassandra table under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public Response GetCassandraTable(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateGetCassandraTableRequest(resourceGroupName, accountName, keyspaceName, tableName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CassandraTableGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CassandraTableGetResults.DeserializeCassandraTableGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateCassandraTableRequest(string resourceGroupName, string accountName, string keyspaceName, string tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateCassandraTableParameters); + request.Content = content; + return message; + } + + /// Create or update an Azure Cosmos DB Cassandra Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The parameters to provide for the current Cassandra Table. + /// The cancellation token to use. + /// , , , , or is null. + public async Task CreateUpdateCassandraTableAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (createUpdateCassandraTableParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateCassandraTableParameters)); + } + + using var message = CreateCreateUpdateCassandraTableRequest(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an Azure Cosmos DB Cassandra Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The parameters to provide for the current Cassandra Table. + /// The cancellation token to use. + /// , , , , or is null. + public Response CreateUpdateCassandraTable(string resourceGroupName, string accountName, string keyspaceName, string tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (createUpdateCassandraTableParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateCassandraTableParameters)); + } + + using var message = CreateCreateUpdateCassandraTableRequest(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteCassandraTableRequest(string resourceGroupName, string accountName, string keyspaceName, string tableName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB Cassandra table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public async Task DeleteCassandraTableAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateDeleteCassandraTableRequest(resourceGroupName, accountName, keyspaceName, tableName); + 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 an existing Azure Cosmos DB Cassandra table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public Response DeleteCassandraTable(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateDeleteCassandraTableRequest(resourceGroupName, accountName, keyspaceName, tableName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetCassandraTableThroughputRequest(string resourceGroupName, string accountName, string keyspaceName, string tableName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetCassandraTableThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateGetCassandraTableThroughputRequest(resourceGroupName, accountName, keyspaceName, tableName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public Response GetCassandraTableThroughput(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateGetCassandraTableThroughputRequest(resourceGroupName, accountName, keyspaceName, tableName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateCassandraTableThroughputRequest(string resourceGroupName, string accountName, string keyspaceName, string tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateThroughputParameters); + request.Content = content; + return message; + } + + /// Update RUs per second of an Azure Cosmos DB Cassandra table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The RUs per second of the parameters to provide for the current Cassandra table. + /// The cancellation token to use. + /// , , , , or is null. + public async Task UpdateCassandraTableThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateCassandraTableThroughputRequest(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update RUs per second of an Azure Cosmos DB Cassandra table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The RUs per second of the parameters to provide for the current Cassandra table. + /// The cancellation token to use. + /// , , , , or is null. + public Response UpdateCassandraTableThroughput(string resourceGroupName, string accountName, string keyspaceName, string tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateCassandraTableThroughputRequest(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateCassandraTableToAutoscaleRequest(string resourceGroupName, string accountName, string keyspaceName, string tableName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public async Task MigrateCassandraTableToAutoscaleAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateMigrateCassandraTableToAutoscaleRequest(resourceGroupName, accountName, keyspaceName, tableName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public Response MigrateCassandraTableToAutoscale(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateMigrateCassandraTableToAutoscaleRequest(resourceGroupName, accountName, keyspaceName, tableName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateCassandraTableToManualThroughputRequest(string resourceGroupName, string accountName, string keyspaceName, string tableName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public async Task MigrateCassandraTableToManualThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateMigrateCassandraTableToManualThroughputRequest(resourceGroupName, accountName, keyspaceName, tableName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , , or is null. + public Response MigrateCassandraTableToManualThroughput(string resourceGroupName, string accountName, string keyspaceName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateMigrateCassandraTableToManualThroughputRequest(resourceGroupName, accountName, keyspaceName, tableName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesUpdateCassandraKeyspaceThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesUpdateCassandraKeyspaceThroughputOperation.cs new file mode 100644 index 000000000000..55ef080993cc --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesUpdateCassandraKeyspaceThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + public partial class CassandraResourcesUpdateCassandraKeyspaceThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal CassandraResourcesUpdateCassandraKeyspaceThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesUpdateCassandraKeyspaceThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesUpdateCassandraTableThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesUpdateCassandraTableThroughputOperation.cs new file mode 100644 index 000000000000..9c6c7bc4eee7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesUpdateCassandraTableThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Update RUs per second of an Azure Cosmos DB Cassandra table. + public partial class CassandraResourcesUpdateCassandraTableThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal CassandraResourcesUpdateCassandraTableThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesUpdateCassandraTableThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionOperations.cs new file mode 100644 index 000000000000..42c1f7ab095d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionOperations.cs @@ -0,0 +1,316 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The Collection service client. + public partial class CollectionOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal CollectionRestOperations RestClient { get; } + /// Initializes a new instance of CollectionOperations for mocking. + protected CollectionOperations() + { + } + /// Initializes a new instance of CollectionOperations. + /// 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 CollectionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new CollectionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Retrieves the metrics determined by the given filter for the given database account and collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , or is null. + public virtual AsyncPageable ListMetricsAsync(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionOperations.ListMetrics"); + scope.Start(); + try + { + var response = await RestClient.ListMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the metrics determined by the given filter for the given database account and collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , or is null. + public virtual Pageable ListMetrics(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionOperations.ListMetrics"); + scope.Start(); + try + { + var response = RestClient.ListMetrics(resourceGroupName, accountName, databaseRid, collectionRid, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Retrieves the usages (most recent storage data) for the given collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// , , , or is null. + public virtual AsyncPageable ListUsagesAsync(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionOperations.ListUsages"); + scope.Start(); + try + { + var response = await RestClient.ListUsagesAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the usages (most recent storage data) for the given collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// , , , or is null. + public virtual Pageable ListUsages(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionOperations.ListUsages"); + scope.Start(); + try + { + var response = RestClient.ListUsages(resourceGroupName, accountName, databaseRid, collectionRid, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Retrieves metric definitions for the given collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// The cancellation token to use. + /// , , , or is null. + public virtual AsyncPageable ListMetricDefinitionsAsync(string resourceGroupName, string accountName, string databaseRid, string collectionRid, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionOperations.ListMetricDefinitions"); + scope.Start(); + try + { + var response = await RestClient.ListMetricDefinitionsAsync(resourceGroupName, accountName, databaseRid, collectionRid, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves metric definitions for the given collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// The cancellation token to use. + /// , , , or is null. + public virtual Pageable ListMetricDefinitions(string resourceGroupName, string accountName, string databaseRid, string collectionRid, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionOperations.ListMetricDefinitions"); + scope.Start(); + try + { + var response = RestClient.ListMetricDefinitions(resourceGroupName, accountName, databaseRid, collectionRid, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionOperations.cs new file mode 100644 index 000000000000..1659f4ba5025 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionOperations.cs @@ -0,0 +1,228 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The CollectionPartition service client. + public partial class CollectionPartitionOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal CollectionPartitionRestOperations RestClient { get; } + /// Initializes a new instance of CollectionPartitionOperations for mocking. + protected CollectionPartitionOperations() + { + } + /// Initializes a new instance of CollectionPartitionOperations. + /// 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 CollectionPartitionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new CollectionPartitionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Retrieves the metrics determined by the given filter for the given collection, split by partition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , or is null. + public virtual AsyncPageable ListMetricsAsync(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionPartitionOperations.ListMetrics"); + scope.Start(); + try + { + var response = await RestClient.ListMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the metrics determined by the given filter for the given collection, split by partition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , or is null. + public virtual Pageable ListMetrics(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionPartitionOperations.ListMetrics"); + scope.Start(); + try + { + var response = RestClient.ListMetrics(resourceGroupName, accountName, databaseRid, collectionRid, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Retrieves the usages (most recent storage data) for the given collection, split by partition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// , , , or is null. + public virtual AsyncPageable ListUsagesAsync(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionPartitionOperations.ListUsages"); + scope.Start(); + try + { + var response = await RestClient.ListUsagesAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the usages (most recent storage data) for the given collection, split by partition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// , , , or is null. + public virtual Pageable ListUsages(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionPartitionOperations.ListUsages"); + scope.Start(); + try + { + var response = RestClient.ListUsages(resourceGroupName, accountName, databaseRid, collectionRid, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionOperations.cs new file mode 100644 index 000000000000..0607d205d4d2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionOperations.cs @@ -0,0 +1,148 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The CollectionPartitionRegion service client. + public partial class CollectionPartitionRegionOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal CollectionPartitionRegionRestOperations RestClient { get; } + /// Initializes a new instance of CollectionPartitionRegionOperations for mocking. + protected CollectionPartitionRegionOperations() + { + } + /// Initializes a new instance of CollectionPartitionRegionOperations. + /// 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 CollectionPartitionRegionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new CollectionPartitionRegionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual AsyncPageable ListMetricsAsync(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionPartitionRegionOperations.ListMetrics"); + scope.Start(); + try + { + var response = await RestClient.ListMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual Pageable ListMetrics(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionPartitionRegionOperations.ListMetrics"); + scope.Start(); + try + { + var response = RestClient.ListMetrics(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionRestOperations.cs new file mode 100644 index 000000000000..3ae981b5f63f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionRestOperations.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class CollectionPartitionRegionRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of CollectionPartitionRegionRestOperations. + /// 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. + /// is null. + public CollectionPartitionRegionRestOperations(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 HttpMessage CreateListMetricsRequest(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/region/", false); + uri.AppendPath(region, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseRid, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionRid, true); + uri.AppendPath("/partitions/metrics", false); + uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + return message; + } + + /// Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , or is null. + public async Task> ListMetricsAsync(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, region, databaseRid, collectionRid, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PartitionMetricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PartitionMetricListResult.DeserializePartitionMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , or is null. + public Response ListMetrics(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, region, databaseRid, collectionRid, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PartitionMetricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PartitionMetricListResult.DeserializePartitionMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRestOperations.cs new file mode 100644 index 000000000000..a19b961cbe3e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRestOperations.cs @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class CollectionPartitionRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of CollectionPartitionRestOperations. + /// 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. + /// is null. + public CollectionPartitionRestOperations(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 HttpMessage CreateListMetricsRequest(string resourceGroupName, string accountName, string databaseRid, string collectionRid, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseRid, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionRid, true); + uri.AppendPath("/partitions/metrics", false); + uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + return message; + } + + /// Retrieves the metrics determined by the given filter for the given collection, split by partition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> ListMetricsAsync(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, databaseRid, collectionRid, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PartitionMetricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PartitionMetricListResult.DeserializePartitionMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the metrics determined by the given filter for the given collection, split by partition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , or is null. + public Response ListMetrics(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, databaseRid, collectionRid, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PartitionMetricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PartitionMetricListResult.DeserializePartitionMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListUsagesRequest(string resourceGroupName, string accountName, string databaseRid, string collectionRid, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseRid, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionRid, true); + uri.AppendPath("/partitions/usages", false); + uri.AppendQuery("api-version", "2020-04-01", true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + request.Uri = uri; + return message; + } + + /// Retrieves the usages (most recent storage data) for the given collection, split by partition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListUsagesAsync(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + + using var message = CreateListUsagesRequest(resourceGroupName, accountName, databaseRid, collectionRid, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PartitionUsagesResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PartitionUsagesResult.DeserializePartitionUsagesResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the usages (most recent storage data) for the given collection, split by partition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// , , , or is null. + public Response ListUsages(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + + using var message = CreateListUsagesRequest(resourceGroupName, accountName, databaseRid, collectionRid, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PartitionUsagesResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PartitionUsagesResult.DeserializePartitionUsagesResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionOperations.cs new file mode 100644 index 000000000000..556afb5bcb76 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionOperations.cs @@ -0,0 +1,148 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The CollectionRegion service client. + public partial class CollectionRegionOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal CollectionRegionRestOperations RestClient { get; } + /// Initializes a new instance of CollectionRegionOperations for mocking. + protected CollectionRegionOperations() + { + } + /// Initializes a new instance of CollectionRegionOperations. + /// 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 CollectionRegionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new CollectionRegionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Retrieves the metrics determined by the given filter for the given database account, collection and region. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual AsyncPageable ListMetricsAsync(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionRegionOperations.ListMetrics"); + scope.Start(); + try + { + var response = await RestClient.ListMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the metrics determined by the given filter for the given database account, collection and region. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual Pageable ListMetrics(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CollectionRegionOperations.ListMetrics"); + scope.Start(); + try + { + var response = RestClient.ListMetrics(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionRestOperations.cs new file mode 100644 index 000000000000..a1c74bb60054 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionRestOperations.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class CollectionRegionRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of CollectionRegionRestOperations. + /// 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. + /// is null. + public CollectionRegionRestOperations(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 HttpMessage CreateListMetricsRequest(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/region/", false); + uri.AppendPath(region, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseRid, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionRid, true); + uri.AppendPath("/metrics", false); + uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + return message; + } + + /// Retrieves the metrics determined by the given filter for the given database account, collection and region. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , or is null. + public async Task> ListMetricsAsync(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, region, databaseRid, collectionRid, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MetricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MetricListResult.DeserializeMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the metrics determined by the given filter for the given database account, collection and region. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , or is null. + public Response ListMetrics(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, region, databaseRid, collectionRid, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MetricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MetricListResult.DeserializeMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRestOperations.cs new file mode 100644 index 000000000000..7d8997517813 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRestOperations.cs @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class CollectionRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of CollectionRestOperations. + /// 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. + /// is null. + public CollectionRestOperations(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 HttpMessage CreateListMetricsRequest(string resourceGroupName, string accountName, string databaseRid, string collectionRid, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseRid, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionRid, true); + uri.AppendPath("/metrics", false); + uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + return message; + } + + /// Retrieves the metrics determined by the given filter for the given database account and collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> ListMetricsAsync(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, databaseRid, collectionRid, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MetricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MetricListResult.DeserializeMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the metrics determined by the given filter for the given database account and collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , or is null. + public Response ListMetrics(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, databaseRid, collectionRid, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MetricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MetricListResult.DeserializeMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListUsagesRequest(string resourceGroupName, string accountName, string databaseRid, string collectionRid, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseRid, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionRid, true); + uri.AppendPath("/usages", false); + uri.AppendQuery("api-version", "2020-04-01", true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + request.Uri = uri; + return message; + } + + /// Retrieves the usages (most recent storage data) for the given collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListUsagesAsync(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + + using var message = CreateListUsagesRequest(resourceGroupName, accountName, databaseRid, collectionRid, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + UsagesResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = UsagesResult.DeserializeUsagesResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the usages (most recent storage data) for the given collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// , , , or is null. + public Response ListUsages(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + + using var message = CreateListUsagesRequest(resourceGroupName, accountName, databaseRid, collectionRid, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + UsagesResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = UsagesResult.DeserializeUsagesResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListMetricDefinitionsRequest(string resourceGroupName, string accountName, string databaseRid, string collectionRid) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseRid, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionRid, true); + uri.AppendPath("/metricDefinitions", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Retrieves metric definitions for the given collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListMetricDefinitionsAsync(string resourceGroupName, string accountName, string databaseRid, string collectionRid, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + + using var message = CreateListMetricDefinitionsRequest(resourceGroupName, accountName, databaseRid, collectionRid); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MetricDefinitionsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MetricDefinitionsListResult.DeserializeMetricDefinitionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves metric definitions for the given collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// The cancellation token to use. + /// , , , or is null. + public Response ListMetricDefinitions(string resourceGroupName, string accountName, string databaseRid, string collectionRid, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + + using var message = CreateListMetricDefinitionsRequest(resourceGroupName, accountName, databaseRid, collectionRid); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MetricDefinitionsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MetricDefinitionsListResult.DeserializeMetricDefinitionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementClient.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementClient.cs new file mode 100644 index 000000000000..c77a899bdeaf --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementClient.cs @@ -0,0 +1,119 @@ +// 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.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB +{ + /// CosmosDB service management client. + public class CosmosDBManagementClient + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + private readonly string _subscriptionId; + private readonly Uri _endpoint; + + /// Initializes a new instance of CosmosDBManagementClient for mocking. + protected CosmosDBManagementClient() + { + } + + /// Initializes a new instance of CosmosDBManagementClient. + /// The ID of the target subscription. + /// The OAuth token for making client requests. + /// The options for configuring the client. + public CosmosDBManagementClient(string subscriptionId, TokenCredential tokenCredential, CosmosDBManagementClientOptions options = null) : this(subscriptionId, null, tokenCredential, options) + { + } + /// Initializes a new instance of CosmosDBManagementClient. + /// The ID of the target subscription. + /// server parameter. + /// The OAuth token for making client requests. + /// The options for configuring the client. + /// is null. + public CosmosDBManagementClient(string subscriptionId, Uri endpoint, TokenCredential tokenCredential, CosmosDBManagementClientOptions options = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + options ??= new CosmosDBManagementClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _pipeline = ManagementPipelineBuilder.Build(tokenCredential, endpoint, options); + _subscriptionId = subscriptionId; + _endpoint = endpoint; + } + + /// Returns an instance of DatabaseAccountsOperations. + public virtual DatabaseAccountsOperations DatabaseAccounts => new DatabaseAccountsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of Operations. + public virtual Operations Operations => new Operations(_clientDiagnostics, _pipeline, _endpoint); + + /// Returns an instance of DatabaseOperations. + public virtual DatabaseOperations Database => new DatabaseOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of CollectionOperations. + public virtual CollectionOperations Collection => new CollectionOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of CollectionRegionOperations. + public virtual CollectionRegionOperations CollectionRegion => new CollectionRegionOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of DatabaseAccountRegionOperations. + public virtual DatabaseAccountRegionOperations DatabaseAccountRegion => new DatabaseAccountRegionOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of PercentileSourceTargetOperations. + public virtual PercentileSourceTargetOperations PercentileSourceTarget => new PercentileSourceTargetOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of PercentileTargetOperations. + public virtual PercentileTargetOperations PercentileTarget => new PercentileTargetOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of PercentileOperations. + public virtual PercentileOperations Percentile => new PercentileOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of CollectionPartitionRegionOperations. + public virtual CollectionPartitionRegionOperations CollectionPartitionRegion => new CollectionPartitionRegionOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of CollectionPartitionOperations. + public virtual CollectionPartitionOperations CollectionPartition => new CollectionPartitionOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of PartitionKeyRangeIdOperations. + public virtual PartitionKeyRangeIdOperations PartitionKeyRangeId => new PartitionKeyRangeIdOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of PartitionKeyRangeIdRegionOperations. + public virtual PartitionKeyRangeIdRegionOperations PartitionKeyRangeIdRegion => new PartitionKeyRangeIdRegionOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of SqlResourcesOperations. + public virtual SqlResourcesOperations SqlResources => new SqlResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of MongoDBResourcesOperations. + public virtual MongoDBResourcesOperations MongoDBResources => new MongoDBResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of TableResourcesOperations. + public virtual TableResourcesOperations TableResources => new TableResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of CassandraResourcesOperations. + public virtual CassandraResourcesOperations CassandraResources => new CassandraResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of GremlinResourcesOperations. + public virtual GremlinResourcesOperations GremlinResources => new GremlinResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of NotebookWorkspacesOperations. + public virtual NotebookWorkspacesOperations NotebookWorkspaces => new NotebookWorkspacesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of PrivateLinkResourcesOperations. + public virtual PrivateLinkResourcesOperations PrivateLinkResources => new PrivateLinkResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of PrivateEndpointConnectionsOperations. + public virtual PrivateEndpointConnectionsOperations PrivateEndpointConnections => new PrivateEndpointConnectionsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementClientOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementClientOptions.cs new file mode 100644 index 000000000000..72e3d9fa2894 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementClientOptions.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Client options for CosmosDB. + public class CosmosDBManagementClientOptions : ClientOptions + { + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionOperations.cs new file mode 100644 index 000000000000..5a14814cfad5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionOperations.cs @@ -0,0 +1,128 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The DatabaseAccountRegion service client. + public partial class DatabaseAccountRegionOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DatabaseAccountRegionRestOperations RestClient { get; } + /// Initializes a new instance of DatabaseAccountRegionOperations for mocking. + protected DatabaseAccountRegionOperations() + { + } + /// Initializes a new instance of DatabaseAccountRegionOperations. + /// 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 DatabaseAccountRegionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DatabaseAccountRegionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Retrieves the metrics determined by the given filter for the given database account and region. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , or is null. + public virtual AsyncPageable ListMetricsAsync(string resourceGroupName, string accountName, string region, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountRegionOperations.ListMetrics"); + scope.Start(); + try + { + var response = await RestClient.ListMetricsAsync(resourceGroupName, accountName, region, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the metrics determined by the given filter for the given database account and region. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , or is null. + public virtual Pageable ListMetrics(string resourceGroupName, string accountName, string region, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountRegionOperations.ListMetrics"); + scope.Start(); + try + { + var response = RestClient.ListMetrics(resourceGroupName, accountName, region, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionRestOperations.cs new file mode 100644 index 000000000000..64400d80dbd4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionRestOperations.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class DatabaseAccountRegionRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DatabaseAccountRegionRestOperations. + /// 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. + /// is null. + public DatabaseAccountRegionRestOperations(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 HttpMessage CreateListMetricsRequest(string resourceGroupName, string accountName, string region, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/region/", false); + uri.AppendPath(region, true); + uri.AppendPath("/metrics", false); + uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + return message; + } + + /// Retrieves the metrics determined by the given filter for the given database account and region. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListMetricsAsync(string resourceGroupName, string accountName, string region, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, region, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MetricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MetricListResult.DeserializeMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the metrics determined by the given filter for the given database account and region. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , or is null. + public Response ListMetrics(string resourceGroupName, string accountName, string region, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, region, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MetricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MetricListResult.DeserializeMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsCreateOrUpdateOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..91bf84d80bf1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsCreateOrUpdateOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. + public partial class DatabaseAccountsCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DatabaseAccountsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabaseAccountsCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DatabaseAccountGetResults 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); + + DatabaseAccountGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return DatabaseAccountGetResults.DeserializeDatabaseAccountGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return DatabaseAccountGetResults.DeserializeDatabaseAccountGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsDeleteOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsDeleteOperation.cs new file mode 100644 index 000000000000..f949f3cae60b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsDeleteOperation.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.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB database account. + public partial class DatabaseAccountsDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DatabaseAccountsDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabaseAccountsDeleteOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsFailoverPriorityChangeOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsFailoverPriorityChangeOperation.cs new file mode 100644 index 000000000000..4e78efada8b0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsFailoverPriorityChangeOperation.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.ResourceManager.CosmosDB +{ + /// Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + public partial class DatabaseAccountsFailoverPriorityChangeOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DatabaseAccountsFailoverPriorityChangeOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabaseAccountsFailoverPriorityChangeOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsOfflineRegionOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsOfflineRegionOperation.cs new file mode 100644 index 000000000000..68397b273d45 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsOfflineRegionOperation.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.ResourceManager.CosmosDB +{ + /// Offline the specified region for the specified Azure Cosmos DB database account. + public partial class DatabaseAccountsOfflineRegionOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DatabaseAccountsOfflineRegionOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabaseAccountsOfflineRegionOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsOnlineRegionOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsOnlineRegionOperation.cs new file mode 100644 index 000000000000..f0d28a4d99d8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsOnlineRegionOperation.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.ResourceManager.CosmosDB +{ + /// Online the specified region for the specified Azure Cosmos DB database account. + public partial class DatabaseAccountsOnlineRegionOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DatabaseAccountsOnlineRegionOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabaseAccountsOnlineRegionOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsOperations.cs new file mode 100644 index 000000000000..9891f4c46e99 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsOperations.cs @@ -0,0 +1,1064 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The DatabaseAccounts service client. + public partial class DatabaseAccountsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DatabaseAccountsRestOperations RestClient { get; } + /// Initializes a new instance of DatabaseAccountsOperations for mocking. + protected DatabaseAccountsOperations() + { + } + /// Initializes a new instance of DatabaseAccountsOperations. + /// 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 DatabaseAccountsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DatabaseAccountsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Retrieves the properties of an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves the properties of an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, accountName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the access keys for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual async Task> ListKeysAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.ListKeys"); + scope.Start(); + try + { + return await RestClient.ListKeysAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the access keys for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual Response ListKeys(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.ListKeys"); + scope.Start(); + try + { + return RestClient.ListKeys(resourceGroupName, accountName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the connection strings for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual async Task> ListConnectionStringsAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.ListConnectionStrings"); + scope.Start(); + try + { + return await RestClient.ListConnectionStringsAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the connection strings for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual Response ListConnectionStrings(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.ListConnectionStrings"); + scope.Start(); + try + { + return RestClient.ListConnectionStrings(resourceGroupName, accountName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the read-only access keys for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual async Task> GetReadOnlyKeysAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.GetReadOnlyKeys"); + scope.Start(); + try + { + return await RestClient.GetReadOnlyKeysAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the read-only access keys for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual Response GetReadOnlyKeys(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.GetReadOnlyKeys"); + scope.Start(); + try + { + return RestClient.GetReadOnlyKeys(resourceGroupName, accountName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the read-only access keys for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual async Task> ListReadOnlyKeysAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.ListReadOnlyKeys"); + scope.Start(); + try + { + return await RestClient.ListReadOnlyKeysAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the read-only access keys for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual Response ListReadOnlyKeys(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.ListReadOnlyKeys"); + scope.Start(); + try + { + return RestClient.ListReadOnlyKeys(resourceGroupName, accountName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual async Task CheckNameExistsAsync(string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.CheckNameExists"); + scope.Start(); + try + { + return await RestClient.CheckNameExistsAsync(accountName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual Response CheckNameExists(string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.CheckNameExists"); + scope.Start(); + try + { + return RestClient.CheckNameExists(accountName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all the Azure Cosmos DB database accounts available under the subscription. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists all the Azure Cosmos DB database accounts available under the subscription. + /// The cancellation token to use. + public virtual Pageable List(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.List"); + scope.Start(); + try + { + var response = RestClient.List(cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Lists all the Azure Cosmos DB database accounts available under the given resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// is null. + 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("DatabaseAccountsOperations.ListByResourceGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists all the Azure Cosmos DB database accounts available under the given resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// is null. + 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("DatabaseAccountsOperations.ListByResourceGroup"); + scope.Start(); + try + { + var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Retrieves the metrics determined by the given filter for the given database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListMetricsAsync(string resourceGroupName, string accountName, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.ListMetrics"); + scope.Start(); + try + { + var response = await RestClient.ListMetricsAsync(resourceGroupName, accountName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the metrics determined by the given filter for the given database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListMetrics(string resourceGroupName, string accountName, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.ListMetrics"); + scope.Start(); + try + { + var response = RestClient.ListMetrics(resourceGroupName, accountName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Retrieves the usages (most recent data) for the given database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListUsagesAsync(string resourceGroupName, string accountName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.ListUsages"); + scope.Start(); + try + { + var response = await RestClient.ListUsagesAsync(resourceGroupName, accountName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the usages (most recent data) for the given database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListUsages(string resourceGroupName, string accountName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.ListUsages"); + scope.Start(); + try + { + var response = RestClient.ListUsages(resourceGroupName, accountName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Retrieves metric definitions for the given database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListMetricDefinitionsAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.ListMetricDefinitions"); + scope.Start(); + try + { + var response = await RestClient.ListMetricDefinitionsAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves metric definitions for the given database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListMetricDefinitions(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.ListMetricDefinitions"); + scope.Start(); + try + { + var response = RestClient.ListMetricDefinitions(resourceGroupName, accountName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Updates the properties of an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The parameters to provide for the current database account. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartUpdateAsync(string resourceGroupName, string accountName, DatabaseAccountUpdateParameters updateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (updateParameters == null) + { + throw new ArgumentNullException(nameof(updateParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateAsync(resourceGroupName, accountName, updateParameters, cancellationToken).ConfigureAwait(false); + return new DatabaseAccountsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, accountName, updateParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates the properties of an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The parameters to provide for the current database account. + /// The cancellation token to use. + /// , , or is null. + public virtual DatabaseAccountsUpdateOperation StartUpdate(string resourceGroupName, string accountName, DatabaseAccountUpdateParameters updateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (updateParameters == null) + { + throw new ArgumentNullException(nameof(updateParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.Update(resourceGroupName, accountName, updateParameters, cancellationToken); + return new DatabaseAccountsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, accountName, updateParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The parameters to provide for the current database account. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (createUpdateParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, accountName, createUpdateParameters, cancellationToken).ConfigureAwait(false); + return new DatabaseAccountsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, accountName, createUpdateParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The parameters to provide for the current database account. + /// The cancellation token to use. + /// , , or is null. + public virtual DatabaseAccountsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (createUpdateParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, accountName, createUpdateParameters, cancellationToken); + return new DatabaseAccountsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, accountName, createUpdateParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual async Task StartDeleteAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return new DatabaseAccountsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, accountName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual DatabaseAccountsDeleteOperation StartDelete(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, accountName, cancellationToken); + return new DatabaseAccountsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, accountName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The new failover policies for the database account. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartFailoverPriorityChangeAsync(string resourceGroupName, string accountName, FailoverPolicies failoverParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (failoverParameters == null) + { + throw new ArgumentNullException(nameof(failoverParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartFailoverPriorityChange"); + scope.Start(); + try + { + var originalResponse = await RestClient.FailoverPriorityChangeAsync(resourceGroupName, accountName, failoverParameters, cancellationToken).ConfigureAwait(false); + return new DatabaseAccountsFailoverPriorityChangeOperation(_clientDiagnostics, _pipeline, RestClient.CreateFailoverPriorityChangeRequest(resourceGroupName, accountName, failoverParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The new failover policies for the database account. + /// The cancellation token to use. + /// , , or is null. + public virtual DatabaseAccountsFailoverPriorityChangeOperation StartFailoverPriorityChange(string resourceGroupName, string accountName, FailoverPolicies failoverParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (failoverParameters == null) + { + throw new ArgumentNullException(nameof(failoverParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartFailoverPriorityChange"); + scope.Start(); + try + { + var originalResponse = RestClient.FailoverPriorityChange(resourceGroupName, accountName, failoverParameters, cancellationToken); + return new DatabaseAccountsFailoverPriorityChangeOperation(_clientDiagnostics, _pipeline, RestClient.CreateFailoverPriorityChangeRequest(resourceGroupName, accountName, failoverParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Offline the specified region for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region to offline for the database account. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartOfflineRegionAsync(string resourceGroupName, string accountName, RegionForOnlineOffline regionParameterForOffline, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (regionParameterForOffline == null) + { + throw new ArgumentNullException(nameof(regionParameterForOffline)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartOfflineRegion"); + scope.Start(); + try + { + var originalResponse = await RestClient.OfflineRegionAsync(resourceGroupName, accountName, regionParameterForOffline, cancellationToken).ConfigureAwait(false); + return new DatabaseAccountsOfflineRegionOperation(_clientDiagnostics, _pipeline, RestClient.CreateOfflineRegionRequest(resourceGroupName, accountName, regionParameterForOffline).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Offline the specified region for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region to offline for the database account. + /// The cancellation token to use. + /// , , or is null. + public virtual DatabaseAccountsOfflineRegionOperation StartOfflineRegion(string resourceGroupName, string accountName, RegionForOnlineOffline regionParameterForOffline, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (regionParameterForOffline == null) + { + throw new ArgumentNullException(nameof(regionParameterForOffline)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartOfflineRegion"); + scope.Start(); + try + { + var originalResponse = RestClient.OfflineRegion(resourceGroupName, accountName, regionParameterForOffline, cancellationToken); + return new DatabaseAccountsOfflineRegionOperation(_clientDiagnostics, _pipeline, RestClient.CreateOfflineRegionRequest(resourceGroupName, accountName, regionParameterForOffline).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Online the specified region for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region to online for the database account. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartOnlineRegionAsync(string resourceGroupName, string accountName, RegionForOnlineOffline regionParameterForOnline, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (regionParameterForOnline == null) + { + throw new ArgumentNullException(nameof(regionParameterForOnline)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartOnlineRegion"); + scope.Start(); + try + { + var originalResponse = await RestClient.OnlineRegionAsync(resourceGroupName, accountName, regionParameterForOnline, cancellationToken).ConfigureAwait(false); + return new DatabaseAccountsOnlineRegionOperation(_clientDiagnostics, _pipeline, RestClient.CreateOnlineRegionRequest(resourceGroupName, accountName, regionParameterForOnline).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Online the specified region for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region to online for the database account. + /// The cancellation token to use. + /// , , or is null. + public virtual DatabaseAccountsOnlineRegionOperation StartOnlineRegion(string resourceGroupName, string accountName, RegionForOnlineOffline regionParameterForOnline, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (regionParameterForOnline == null) + { + throw new ArgumentNullException(nameof(regionParameterForOnline)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartOnlineRegion"); + scope.Start(); + try + { + var originalResponse = RestClient.OnlineRegion(resourceGroupName, accountName, regionParameterForOnline, cancellationToken); + return new DatabaseAccountsOnlineRegionOperation(_clientDiagnostics, _pipeline, RestClient.CreateOnlineRegionRequest(resourceGroupName, accountName, regionParameterForOnline).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Regenerates an access key for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the key to regenerate. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartRegenerateKeyAsync(string resourceGroupName, string accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyToRegenerate == null) + { + throw new ArgumentNullException(nameof(keyToRegenerate)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartRegenerateKey"); + scope.Start(); + try + { + var originalResponse = await RestClient.RegenerateKeyAsync(resourceGroupName, accountName, keyToRegenerate, cancellationToken).ConfigureAwait(false); + return new DatabaseAccountsRegenerateKeyOperation(_clientDiagnostics, _pipeline, RestClient.CreateRegenerateKeyRequest(resourceGroupName, accountName, keyToRegenerate).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Regenerates an access key for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the key to regenerate. + /// The cancellation token to use. + /// , , or is null. + public virtual DatabaseAccountsRegenerateKeyOperation StartRegenerateKey(string resourceGroupName, string accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyToRegenerate == null) + { + throw new ArgumentNullException(nameof(keyToRegenerate)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseAccountsOperations.StartRegenerateKey"); + scope.Start(); + try + { + var originalResponse = RestClient.RegenerateKey(resourceGroupName, accountName, keyToRegenerate, cancellationToken); + return new DatabaseAccountsRegenerateKeyOperation(_clientDiagnostics, _pipeline, RestClient.CreateRegenerateKeyRequest(resourceGroupName, accountName, keyToRegenerate).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsRegenerateKeyOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsRegenerateKeyOperation.cs new file mode 100644 index 000000000000..573e950545b0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsRegenerateKeyOperation.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.ResourceManager.CosmosDB +{ + /// Regenerates an access key for the specified Azure Cosmos DB database account. + public partial class DatabaseAccountsRegenerateKeyOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DatabaseAccountsRegenerateKeyOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabaseAccountsRegenerateKeyOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsRestOperations.cs new file mode 100644 index 000000000000..29ab53587539 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsRestOperations.cs @@ -0,0 +1,1514 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class DatabaseAccountsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DatabaseAccountsRestOperations. + /// 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. + /// is null. + public DatabaseAccountsRestOperations(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 HttpMessage CreateGetRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Retrieves the properties of an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> GetAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateGetRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseAccountGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseAccountGetResults.DeserializeDatabaseAccountGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the properties of an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response Get(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateGetRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseAccountGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseAccountGetResults.DeserializeDatabaseAccountGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string accountName, DatabaseAccountUpdateParameters updateParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateParameters); + request.Content = content; + return message; + } + + /// Updates the properties of an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The parameters to provide for the current database account. + /// The cancellation token to use. + /// , , or is null. + public async Task UpdateAsync(string resourceGroupName, string accountName, DatabaseAccountUpdateParameters updateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (updateParameters == null) + { + throw new ArgumentNullException(nameof(updateParameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, accountName, updateParameters); + 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); + } + } + + /// Updates the properties of an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The parameters to provide for the current database account. + /// The cancellation token to use. + /// , , or is null. + public Response Update(string resourceGroupName, string accountName, DatabaseAccountUpdateParameters updateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (updateParameters == null) + { + throw new ArgumentNullException(nameof(updateParameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, accountName, updateParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateParameters); + request.Content = content; + return message; + } + + /// Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The parameters to provide for the current database account. + /// The cancellation token to use. + /// , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (createUpdateParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateParameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, createUpdateParameters); + 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); + } + } + + /// Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The parameters to provide for the current database account. + /// The cancellation token to use. + /// , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (createUpdateParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateParameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, createUpdateParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task DeleteAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, accountName); + 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 an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response Delete(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateFailoverPriorityChangeRequest(string resourceGroupName, string accountName, FailoverPolicies failoverParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/failoverPriorityChange", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(failoverParameters); + request.Content = content; + return message; + } + + /// Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The new failover policies for the database account. + /// The cancellation token to use. + /// , , or is null. + public async Task FailoverPriorityChangeAsync(string resourceGroupName, string accountName, FailoverPolicies failoverParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (failoverParameters == null) + { + throw new ArgumentNullException(nameof(failoverParameters)); + } + + using var message = CreateFailoverPriorityChangeRequest(resourceGroupName, accountName, failoverParameters); + 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); + } + } + + /// Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The new failover policies for the database account. + /// The cancellation token to use. + /// , , or is null. + public Response FailoverPriorityChange(string resourceGroupName, string accountName, FailoverPolicies failoverParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (failoverParameters == null) + { + throw new ArgumentNullException(nameof(failoverParameters)); + } + + using var message = CreateFailoverPriorityChangeRequest(resourceGroupName, accountName, failoverParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal 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.DocumentDB/databaseAccounts", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists all the Azure Cosmos DB database accounts available under the subscription. + /// The cancellation token to use. + public async Task> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseAccountsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseAccountsListResult.DeserializeDatabaseAccountsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists all the Azure Cosmos DB database accounts available under the 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: + { + DatabaseAccountsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseAccountsListResult.DeserializeDatabaseAccountsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal 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.DocumentDB/databaseAccounts", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists all the Azure Cosmos DB database accounts available under the given resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// is null. + public async Task> 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: + { + DatabaseAccountsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseAccountsListResult.DeserializeDatabaseAccountsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists all the Azure Cosmos DB database accounts available under the given resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// is null. + 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: + { + DatabaseAccountsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseAccountsListResult.DeserializeDatabaseAccountsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListKeysRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/listKeys", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the access keys for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListKeysAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListKeysRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseAccountListKeysResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseAccountListKeysResult.DeserializeDatabaseAccountListKeysResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the access keys for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListKeys(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListKeysRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseAccountListKeysResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseAccountListKeysResult.DeserializeDatabaseAccountListKeysResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListConnectionStringsRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/listConnectionStrings", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the connection strings for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListConnectionStringsAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListConnectionStringsRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseAccountListConnectionStringsResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseAccountListConnectionStringsResult.DeserializeDatabaseAccountListConnectionStringsResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the connection strings for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListConnectionStrings(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListConnectionStringsRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseAccountListConnectionStringsResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseAccountListConnectionStringsResult.DeserializeDatabaseAccountListConnectionStringsResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateOfflineRegionRequest(string resourceGroupName, string accountName, RegionForOnlineOffline regionParameterForOffline) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/offlineRegion", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(regionParameterForOffline); + request.Content = content; + return message; + } + + /// Offline the specified region for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region to offline for the database account. + /// The cancellation token to use. + /// , , or is null. + public async Task OfflineRegionAsync(string resourceGroupName, string accountName, RegionForOnlineOffline regionParameterForOffline, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (regionParameterForOffline == null) + { + throw new ArgumentNullException(nameof(regionParameterForOffline)); + } + + using var message = CreateOfflineRegionRequest(resourceGroupName, accountName, regionParameterForOffline); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Offline the specified region for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region to offline for the database account. + /// The cancellation token to use. + /// , , or is null. + public Response OfflineRegion(string resourceGroupName, string accountName, RegionForOnlineOffline regionParameterForOffline, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (regionParameterForOffline == null) + { + throw new ArgumentNullException(nameof(regionParameterForOffline)); + } + + using var message = CreateOfflineRegionRequest(resourceGroupName, accountName, regionParameterForOffline); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateOnlineRegionRequest(string resourceGroupName, string accountName, RegionForOnlineOffline regionParameterForOnline) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/onlineRegion", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(regionParameterForOnline); + request.Content = content; + return message; + } + + /// Online the specified region for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region to online for the database account. + /// The cancellation token to use. + /// , , or is null. + public async Task OnlineRegionAsync(string resourceGroupName, string accountName, RegionForOnlineOffline regionParameterForOnline, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (regionParameterForOnline == null) + { + throw new ArgumentNullException(nameof(regionParameterForOnline)); + } + + using var message = CreateOnlineRegionRequest(resourceGroupName, accountName, regionParameterForOnline); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Online the specified region for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region to online for the database account. + /// The cancellation token to use. + /// , , or is null. + public Response OnlineRegion(string resourceGroupName, string accountName, RegionForOnlineOffline regionParameterForOnline, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (regionParameterForOnline == null) + { + throw new ArgumentNullException(nameof(regionParameterForOnline)); + } + + using var message = CreateOnlineRegionRequest(resourceGroupName, accountName, regionParameterForOnline); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetReadOnlyKeysRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/readonlykeys", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the read-only access keys for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> GetReadOnlyKeysAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateGetReadOnlyKeysRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseAccountListReadOnlyKeysResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseAccountListReadOnlyKeysResult.DeserializeDatabaseAccountListReadOnlyKeysResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the read-only access keys for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response GetReadOnlyKeys(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateGetReadOnlyKeysRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseAccountListReadOnlyKeysResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseAccountListReadOnlyKeysResult.DeserializeDatabaseAccountListReadOnlyKeysResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListReadOnlyKeysRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/readonlykeys", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the read-only access keys for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListReadOnlyKeysAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListReadOnlyKeysRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseAccountListReadOnlyKeysResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseAccountListReadOnlyKeysResult.DeserializeDatabaseAccountListReadOnlyKeysResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the read-only access keys for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListReadOnlyKeys(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListReadOnlyKeysRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseAccountListReadOnlyKeysResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseAccountListReadOnlyKeysResult.DeserializeDatabaseAccountListReadOnlyKeysResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRegenerateKeyRequest(string resourceGroupName, string accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/regenerateKey", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(keyToRegenerate); + request.Content = content; + return message; + } + + /// Regenerates an access key for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the key to regenerate. + /// The cancellation token to use. + /// , , or is null. + public async Task RegenerateKeyAsync(string resourceGroupName, string accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyToRegenerate == null) + { + throw new ArgumentNullException(nameof(keyToRegenerate)); + } + + using var message = CreateRegenerateKeyRequest(resourceGroupName, accountName, keyToRegenerate); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Regenerates an access key for the specified Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the key to regenerate. + /// The cancellation token to use. + /// , , or is null. + public Response RegenerateKey(string resourceGroupName, string accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyToRegenerate == null) + { + throw new ArgumentNullException(nameof(keyToRegenerate)); + } + + using var message = CreateRegenerateKeyRequest(resourceGroupName, accountName, keyToRegenerate); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCheckNameExistsRequest(string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccountNames/", false); + uri.AppendPath(accountName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// is null. + public async Task CheckNameExistsAsync(string accountName, CancellationToken cancellationToken = default) + { + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateCheckNameExistsRequest(accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 404: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// is null. + public Response CheckNameExists(string accountName, CancellationToken cancellationToken = default) + { + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateCheckNameExistsRequest(accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 404: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string accountName, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/metrics", false); + uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + return message; + } + + /// Retrieves the metrics determined by the given filter for the given database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListMetricsAsync(string resourceGroupName, string accountName, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MetricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MetricListResult.DeserializeMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the metrics determined by the given filter for the given database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , or is null. + public Response ListMetrics(string resourceGroupName, string accountName, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MetricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MetricListResult.DeserializeMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListUsagesRequest(string resourceGroupName, string accountName, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/usages", false); + uri.AppendQuery("api-version", "2020-04-01", true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + request.Uri = uri; + return message; + } + + /// Retrieves the usages (most recent data) for the given database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// or is null. + public async Task> ListUsagesAsync(string resourceGroupName, string accountName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListUsagesRequest(resourceGroupName, accountName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + UsagesResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = UsagesResult.DeserializeUsagesResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the usages (most recent data) for the given database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// or is null. + public Response ListUsages(string resourceGroupName, string accountName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListUsagesRequest(resourceGroupName, accountName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + UsagesResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = UsagesResult.DeserializeUsagesResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListMetricDefinitionsRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/metricDefinitions", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Retrieves metric definitions for the given database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListMetricDefinitionsAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListMetricDefinitionsRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MetricDefinitionsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MetricDefinitionsListResult.DeserializeMetricDefinitionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves metric definitions for the given database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListMetricDefinitions(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListMetricDefinitionsRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MetricDefinitionsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MetricDefinitionsListResult.DeserializeMetricDefinitionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsUpdateOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsUpdateOperation.cs new file mode 100644 index 000000000000..b1f752abee0f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsUpdateOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Updates the properties of an existing Azure Cosmos DB database account. + public partial class DatabaseAccountsUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal DatabaseAccountsUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabaseAccountsUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DatabaseAccountGetResults 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); + + DatabaseAccountGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return DatabaseAccountGetResults.DeserializeDatabaseAccountGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return DatabaseAccountGetResults.DeserializeDatabaseAccountGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseOperations.cs new file mode 100644 index 000000000000..6e9c1a48b7cf --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseOperations.cs @@ -0,0 +1,286 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The Database service client. + public partial class DatabaseOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DatabaseRestOperations RestClient { get; } + /// Initializes a new instance of DatabaseOperations for mocking. + protected DatabaseOperations() + { + } + /// Initializes a new instance of DatabaseOperations. + /// 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 DatabaseOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DatabaseRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Retrieves the metrics determined by the given filter for the given database account and database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , or is null. + public virtual AsyncPageable ListMetricsAsync(string resourceGroupName, string accountName, string databaseRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseOperations.ListMetrics"); + scope.Start(); + try + { + var response = await RestClient.ListMetricsAsync(resourceGroupName, accountName, databaseRid, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the metrics determined by the given filter for the given database account and database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , or is null. + public virtual Pageable ListMetrics(string resourceGroupName, string accountName, string databaseRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseOperations.ListMetrics"); + scope.Start(); + try + { + var response = RestClient.ListMetrics(resourceGroupName, accountName, databaseRid, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Retrieves the usages (most recent data) for the given database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListUsagesAsync(string resourceGroupName, string accountName, string databaseRid, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseOperations.ListUsages"); + scope.Start(); + try + { + var response = await RestClient.ListUsagesAsync(resourceGroupName, accountName, databaseRid, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the usages (most recent data) for the given database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListUsages(string resourceGroupName, string accountName, string databaseRid, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseOperations.ListUsages"); + scope.Start(); + try + { + var response = RestClient.ListUsages(resourceGroupName, accountName, databaseRid, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Retrieves metric definitions for the given database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListMetricDefinitionsAsync(string resourceGroupName, string accountName, string databaseRid, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseOperations.ListMetricDefinitions"); + scope.Start(); + try + { + var response = await RestClient.ListMetricDefinitionsAsync(resourceGroupName, accountName, databaseRid, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves metric definitions for the given database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListMetricDefinitions(string resourceGroupName, string accountName, string databaseRid, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseOperations.ListMetricDefinitions"); + scope.Start(); + try + { + var response = RestClient.ListMetricDefinitions(resourceGroupName, accountName, databaseRid, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseRestOperations.cs new file mode 100644 index 000000000000..0bc723ec4ef0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseRestOperations.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class DatabaseRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DatabaseRestOperations. + /// 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. + /// is null. + public DatabaseRestOperations(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 HttpMessage CreateListMetricsRequest(string resourceGroupName, string accountName, string databaseRid, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseRid, true); + uri.AppendPath("/metrics", false); + uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + return message; + } + + /// Retrieves the metrics determined by the given filter for the given database account and database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListMetricsAsync(string resourceGroupName, string accountName, string databaseRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, databaseRid, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MetricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MetricListResult.DeserializeMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the metrics determined by the given filter for the given database account and database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , or is null. + public Response ListMetrics(string resourceGroupName, string accountName, string databaseRid, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, databaseRid, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MetricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MetricListResult.DeserializeMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListUsagesRequest(string resourceGroupName, string accountName, string databaseRid, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseRid, true); + uri.AppendPath("/usages", false); + uri.AppendQuery("api-version", "2020-04-01", true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + request.Uri = uri; + return message; + } + + /// Retrieves the usages (most recent data) for the given database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// , , or is null. + public async Task> ListUsagesAsync(string resourceGroupName, string accountName, string databaseRid, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + + using var message = CreateListUsagesRequest(resourceGroupName, accountName, databaseRid, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + UsagesResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = UsagesResult.DeserializeUsagesResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the usages (most recent data) for the given database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// , , or is null. + public Response ListUsages(string resourceGroupName, string accountName, string databaseRid, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + + using var message = CreateListUsagesRequest(resourceGroupName, accountName, databaseRid, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + UsagesResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = UsagesResult.DeserializeUsagesResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListMetricDefinitionsRequest(string resourceGroupName, string accountName, string databaseRid) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseRid, true); + uri.AppendPath("/metricDefinitions", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Retrieves metric definitions for the given database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListMetricDefinitionsAsync(string resourceGroupName, string accountName, string databaseRid, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + + using var message = CreateListMetricDefinitionsRequest(resourceGroupName, accountName, databaseRid); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MetricDefinitionsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MetricDefinitionsListResult.DeserializeMetricDefinitionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves metric definitions for the given database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// The cancellation token to use. + /// , , or is null. + public Response ListMetricDefinitions(string resourceGroupName, string accountName, string databaseRid, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + + using var message = CreateListMetricDefinitionsRequest(resourceGroupName, accountName, databaseRid); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MetricDefinitionsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MetricDefinitionsListResult.DeserializeMetricDefinitionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesCreateUpdateGremlinDatabaseOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesCreateUpdateGremlinDatabaseOperation.cs new file mode 100644 index 000000000000..28e21be7773f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesCreateUpdateGremlinDatabaseOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update an Azure Cosmos DB Gremlin database. + public partial class GremlinResourcesCreateUpdateGremlinDatabaseOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal GremlinResourcesCreateUpdateGremlinDatabaseOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GremlinResourcesCreateUpdateGremlinDatabaseOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override GremlinDatabaseGetResults 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); + + GremlinDatabaseGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return GremlinDatabaseGetResults.DeserializeGremlinDatabaseGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return GremlinDatabaseGetResults.DeserializeGremlinDatabaseGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesCreateUpdateGremlinGraphOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesCreateUpdateGremlinGraphOperation.cs new file mode 100644 index 000000000000..cf567704e02b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesCreateUpdateGremlinGraphOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update an Azure Cosmos DB Gremlin graph. + public partial class GremlinResourcesCreateUpdateGremlinGraphOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal GremlinResourcesCreateUpdateGremlinGraphOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GremlinResourcesCreateUpdateGremlinGraphOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override GremlinGraphGetResults 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); + + GremlinGraphGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return GremlinGraphGetResults.DeserializeGremlinGraphGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return GremlinGraphGetResults.DeserializeGremlinGraphGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesDeleteGremlinDatabaseOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesDeleteGremlinDatabaseOperation.cs new file mode 100644 index 000000000000..c173fe0d51a5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesDeleteGremlinDatabaseOperation.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.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB Gremlin database. + public partial class GremlinResourcesDeleteGremlinDatabaseOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal GremlinResourcesDeleteGremlinDatabaseOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GremlinResourcesDeleteGremlinDatabaseOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesDeleteGremlinGraphOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesDeleteGremlinGraphOperation.cs new file mode 100644 index 000000000000..e79f441fc9fa --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesDeleteGremlinGraphOperation.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.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB Gremlin graph. + public partial class GremlinResourcesDeleteGremlinGraphOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal GremlinResourcesDeleteGremlinGraphOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GremlinResourcesDeleteGremlinGraphOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesMigrateGremlinDatabaseToAutoscaleOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesMigrateGremlinDatabaseToAutoscaleOperation.cs new file mode 100644 index 000000000000..ec584a43a075 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesMigrateGremlinDatabaseToAutoscaleOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + public partial class GremlinResourcesMigrateGremlinDatabaseToAutoscaleOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal GremlinResourcesMigrateGremlinDatabaseToAutoscaleOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GremlinResourcesMigrateGremlinDatabaseToAutoscaleOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesMigrateGremlinDatabaseToManualThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesMigrateGremlinDatabaseToManualThroughputOperation.cs new file mode 100644 index 000000000000..f3573bd068b1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesMigrateGremlinDatabaseToManualThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + public partial class GremlinResourcesMigrateGremlinDatabaseToManualThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal GremlinResourcesMigrateGremlinDatabaseToManualThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GremlinResourcesMigrateGremlinDatabaseToManualThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesMigrateGremlinGraphToAutoscaleOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesMigrateGremlinGraphToAutoscaleOperation.cs new file mode 100644 index 000000000000..31ce9daf3101 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesMigrateGremlinGraphToAutoscaleOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + public partial class GremlinResourcesMigrateGremlinGraphToAutoscaleOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal GremlinResourcesMigrateGremlinGraphToAutoscaleOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GremlinResourcesMigrateGremlinGraphToAutoscaleOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesMigrateGremlinGraphToManualThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesMigrateGremlinGraphToManualThroughputOperation.cs new file mode 100644 index 000000000000..02d9099092d7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesMigrateGremlinGraphToManualThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + public partial class GremlinResourcesMigrateGremlinGraphToManualThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal GremlinResourcesMigrateGremlinGraphToManualThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GremlinResourcesMigrateGremlinGraphToManualThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesOperations.cs new file mode 100644 index 000000000000..e72ba86ec411 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesOperations.cs @@ -0,0 +1,1140 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The GremlinResources service client. + public partial class GremlinResourcesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal GremlinResourcesRestOperations RestClient { get; } + /// Initializes a new instance of GremlinResourcesOperations for mocking. + protected GremlinResourcesOperations() + { + } + /// Initializes a new instance of GremlinResourcesOperations. + /// 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 GremlinResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new GremlinResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + public virtual async Task> GetGremlinDatabaseAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.GetGremlinDatabase"); + scope.Start(); + try + { + return await RestClient.GetGremlinDatabaseAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + public virtual Response GetGremlinDatabase(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.GetGremlinDatabase"); + scope.Start(); + try + { + return RestClient.GetGremlinDatabase(resourceGroupName, accountName, databaseName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + public virtual async Task> GetGremlinDatabaseThroughputAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.GetGremlinDatabaseThroughput"); + scope.Start(); + try + { + return await RestClient.GetGremlinDatabaseThroughputAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + public virtual Response GetGremlinDatabaseThroughput(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.GetGremlinDatabaseThroughput"); + scope.Start(); + try + { + return RestClient.GetGremlinDatabaseThroughput(resourceGroupName, accountName, databaseName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the Gremlin graph under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + public virtual async Task> GetGremlinGraphAsync(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.GetGremlinGraph"); + scope.Start(); + try + { + return await RestClient.GetGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the Gremlin graph under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + public virtual Response GetGremlinGraph(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.GetGremlinGraph"); + scope.Start(); + try + { + return RestClient.GetGremlinGraph(resourceGroupName, accountName, databaseName, graphName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + public virtual async Task> GetGremlinGraphThroughputAsync(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.GetGremlinGraphThroughput"); + scope.Start(); + try + { + return await RestClient.GetGremlinGraphThroughputAsync(resourceGroupName, accountName, databaseName, graphName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + public virtual Response GetGremlinGraphThroughput(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.GetGremlinGraphThroughput"); + scope.Start(); + try + { + return RestClient.GetGremlinGraphThroughput(resourceGroupName, accountName, databaseName, graphName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the Gremlin databases under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListGremlinDatabasesAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.ListGremlinDatabases"); + scope.Start(); + try + { + var response = await RestClient.ListGremlinDatabasesAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the Gremlin databases under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListGremlinDatabases(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.ListGremlinDatabases"); + scope.Start(); + try + { + var response = RestClient.ListGremlinDatabases(resourceGroupName, accountName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Lists the Gremlin graph under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListGremlinGraphsAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.ListGremlinGraphs"); + scope.Start(); + try + { + var response = await RestClient.ListGremlinGraphsAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the Gremlin graph under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListGremlinGraphs(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.ListGremlinGraphs"); + scope.Start(); + try + { + var response = RestClient.ListGremlinGraphs(resourceGroupName, accountName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Create or update an Azure Cosmos DB Gremlin database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the current Gremlin database. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateUpdateGremlinDatabaseAsync(string resourceGroupName, string accountName, string databaseName, GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (createUpdateGremlinDatabaseParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateGremlinDatabaseParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartCreateUpdateGremlinDatabase"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateGremlinDatabaseAsync(resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters, cancellationToken).ConfigureAwait(false); + return new GremlinResourcesCreateUpdateGremlinDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateGremlinDatabaseRequest(resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB Gremlin database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the current Gremlin database. + /// The cancellation token to use. + /// , , , or is null. + public virtual GremlinResourcesCreateUpdateGremlinDatabaseOperation StartCreateUpdateGremlinDatabase(string resourceGroupName, string accountName, string databaseName, GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (createUpdateGremlinDatabaseParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateGremlinDatabaseParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartCreateUpdateGremlinDatabase"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateGremlinDatabase(resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters, cancellationToken); + return new GremlinResourcesCreateUpdateGremlinDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateGremlinDatabaseRequest(resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Gremlin database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteGremlinDatabaseAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartDeleteGremlinDatabase"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + return new GremlinResourcesDeleteGremlinDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteGremlinDatabaseRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Gremlin database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual GremlinResourcesDeleteGremlinDatabaseOperation StartDeleteGremlinDatabase(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartDeleteGremlinDatabase"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteGremlinDatabase(resourceGroupName, accountName, databaseName, cancellationToken); + return new GremlinResourcesDeleteGremlinDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteGremlinDatabaseRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB Gremlin database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The RUs per second of the parameters to provide for the current Gremlin database. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartUpdateGremlinDatabaseThroughputAsync(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartUpdateGremlinDatabaseThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateGremlinDatabaseThroughputAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters, cancellationToken).ConfigureAwait(false); + return new GremlinResourcesUpdateGremlinDatabaseThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateGremlinDatabaseThroughputRequest(resourceGroupName, accountName, databaseName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB Gremlin database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The RUs per second of the parameters to provide for the current Gremlin database. + /// The cancellation token to use. + /// , , , or is null. + public virtual GremlinResourcesUpdateGremlinDatabaseThroughputOperation StartUpdateGremlinDatabaseThroughput(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartUpdateGremlinDatabaseThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.UpdateGremlinDatabaseThroughput(resourceGroupName, accountName, databaseName, updateThroughputParameters, cancellationToken); + return new GremlinResourcesUpdateGremlinDatabaseThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateGremlinDatabaseThroughputRequest(resourceGroupName, accountName, databaseName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartMigrateGremlinDatabaseToAutoscaleAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartMigrateGremlinDatabaseToAutoscale"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateGremlinDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + return new GremlinResourcesMigrateGremlinDatabaseToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateGremlinDatabaseToAutoscaleRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual GremlinResourcesMigrateGremlinDatabaseToAutoscaleOperation StartMigrateGremlinDatabaseToAutoscale(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartMigrateGremlinDatabaseToAutoscale"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateGremlinDatabaseToAutoscale(resourceGroupName, accountName, databaseName, cancellationToken); + return new GremlinResourcesMigrateGremlinDatabaseToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateGremlinDatabaseToAutoscaleRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartMigrateGremlinDatabaseToManualThroughputAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartMigrateGremlinDatabaseToManualThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateGremlinDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + return new GremlinResourcesMigrateGremlinDatabaseToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateGremlinDatabaseToManualThroughputRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual GremlinResourcesMigrateGremlinDatabaseToManualThroughputOperation StartMigrateGremlinDatabaseToManualThroughput(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartMigrateGremlinDatabaseToManualThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateGremlinDatabaseToManualThroughput(resourceGroupName, accountName, databaseName, cancellationToken); + return new GremlinResourcesMigrateGremlinDatabaseToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateGremlinDatabaseToManualThroughputRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB Gremlin graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The parameters to provide for the current Gremlin graph. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartCreateUpdateGremlinGraphAsync(string resourceGroupName, string accountName, string databaseName, string graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + if (createUpdateGremlinGraphParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateGremlinGraphParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartCreateUpdateGremlinGraph"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters, cancellationToken).ConfigureAwait(false); + return new GremlinResourcesCreateUpdateGremlinGraphOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateGremlinGraphRequest(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB Gremlin graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The parameters to provide for the current Gremlin graph. + /// The cancellation token to use. + /// , , , , or is null. + public virtual GremlinResourcesCreateUpdateGremlinGraphOperation StartCreateUpdateGremlinGraph(string resourceGroupName, string accountName, string databaseName, string graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + if (createUpdateGremlinGraphParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateGremlinGraphParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartCreateUpdateGremlinGraph"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateGremlinGraph(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters, cancellationToken); + return new GremlinResourcesCreateUpdateGremlinGraphOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateGremlinGraphRequest(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Gremlin graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartDeleteGremlinGraphAsync(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartDeleteGremlinGraph"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName, cancellationToken).ConfigureAwait(false); + return new GremlinResourcesDeleteGremlinGraphOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteGremlinGraphRequest(resourceGroupName, accountName, databaseName, graphName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Gremlin graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public virtual GremlinResourcesDeleteGremlinGraphOperation StartDeleteGremlinGraph(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartDeleteGremlinGraph"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteGremlinGraph(resourceGroupName, accountName, databaseName, graphName, cancellationToken); + return new GremlinResourcesDeleteGremlinGraphOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteGremlinGraphRequest(resourceGroupName, accountName, databaseName, graphName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB Gremlin graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The RUs per second of the parameters to provide for the current Gremlin graph. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartUpdateGremlinGraphThroughputAsync(string resourceGroupName, string accountName, string databaseName, string graphName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartUpdateGremlinGraphThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateGremlinGraphThroughputAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters, cancellationToken).ConfigureAwait(false); + return new GremlinResourcesUpdateGremlinGraphThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateGremlinGraphThroughputRequest(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB Gremlin graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The RUs per second of the parameters to provide for the current Gremlin graph. + /// The cancellation token to use. + /// , , , , or is null. + public virtual GremlinResourcesUpdateGremlinGraphThroughputOperation StartUpdateGremlinGraphThroughput(string resourceGroupName, string accountName, string databaseName, string graphName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartUpdateGremlinGraphThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.UpdateGremlinGraphThroughput(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters, cancellationToken); + return new GremlinResourcesUpdateGremlinGraphThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateGremlinGraphThroughputRequest(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartMigrateGremlinGraphToAutoscaleAsync(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartMigrateGremlinGraphToAutoscale"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateGremlinGraphToAutoscaleAsync(resourceGroupName, accountName, databaseName, graphName, cancellationToken).ConfigureAwait(false); + return new GremlinResourcesMigrateGremlinGraphToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateGremlinGraphToAutoscaleRequest(resourceGroupName, accountName, databaseName, graphName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public virtual GremlinResourcesMigrateGremlinGraphToAutoscaleOperation StartMigrateGremlinGraphToAutoscale(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartMigrateGremlinGraphToAutoscale"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateGremlinGraphToAutoscale(resourceGroupName, accountName, databaseName, graphName, cancellationToken); + return new GremlinResourcesMigrateGremlinGraphToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateGremlinGraphToAutoscaleRequest(resourceGroupName, accountName, databaseName, graphName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartMigrateGremlinGraphToManualThroughputAsync(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartMigrateGremlinGraphToManualThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateGremlinGraphToManualThroughputAsync(resourceGroupName, accountName, databaseName, graphName, cancellationToken).ConfigureAwait(false); + return new GremlinResourcesMigrateGremlinGraphToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateGremlinGraphToManualThroughputRequest(resourceGroupName, accountName, databaseName, graphName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public virtual GremlinResourcesMigrateGremlinGraphToManualThroughputOperation StartMigrateGremlinGraphToManualThroughput(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var scope = _clientDiagnostics.CreateScope("GremlinResourcesOperations.StartMigrateGremlinGraphToManualThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateGremlinGraphToManualThroughput(resourceGroupName, accountName, databaseName, graphName, cancellationToken); + return new GremlinResourcesMigrateGremlinGraphToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateGremlinGraphToManualThroughputRequest(resourceGroupName, accountName, databaseName, graphName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesRestOperations.cs new file mode 100644 index 000000000000..7e934f016b7f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesRestOperations.cs @@ -0,0 +1,1608 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class GremlinResourcesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of GremlinResourcesRestOperations. + /// 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. + /// is null. + public GremlinResourcesRestOperations(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 HttpMessage CreateListGremlinDatabasesRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the Gremlin databases under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListGremlinDatabasesAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListGremlinDatabasesRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GremlinDatabaseListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GremlinDatabaseListResult.DeserializeGremlinDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the Gremlin databases under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListGremlinDatabases(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListGremlinDatabasesRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GremlinDatabaseListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GremlinDatabaseListResult.DeserializeGremlinDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetGremlinDatabaseRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetGremlinDatabaseAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetGremlinDatabaseRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GremlinDatabaseGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GremlinDatabaseGetResults.DeserializeGremlinDatabaseGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response GetGremlinDatabase(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetGremlinDatabaseRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GremlinDatabaseGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GremlinDatabaseGetResults.DeserializeGremlinDatabaseGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateGremlinDatabaseRequest(string resourceGroupName, string accountName, string databaseName, GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateGremlinDatabaseParameters); + request.Content = content; + return message; + } + + /// Create or update an Azure Cosmos DB Gremlin database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the current Gremlin database. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateUpdateGremlinDatabaseAsync(string resourceGroupName, string accountName, string databaseName, GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (createUpdateGremlinDatabaseParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateGremlinDatabaseParameters)); + } + + using var message = CreateCreateUpdateGremlinDatabaseRequest(resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an Azure Cosmos DB Gremlin database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the current Gremlin database. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateUpdateGremlinDatabase(string resourceGroupName, string accountName, string databaseName, GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (createUpdateGremlinDatabaseParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateGremlinDatabaseParameters)); + } + + using var message = CreateCreateUpdateGremlinDatabaseRequest(resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteGremlinDatabaseRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB Gremlin database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteGremlinDatabaseAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateDeleteGremlinDatabaseRequest(resourceGroupName, accountName, databaseName); + 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 an existing Azure Cosmos DB Gremlin database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response DeleteGremlinDatabase(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateDeleteGremlinDatabaseRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetGremlinDatabaseThroughputRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetGremlinDatabaseThroughputAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetGremlinDatabaseThroughputRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response GetGremlinDatabaseThroughput(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetGremlinDatabaseThroughputRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateGremlinDatabaseThroughputRequest(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateThroughputParameters); + request.Content = content; + return message; + } + + /// Update RUs per second of an Azure Cosmos DB Gremlin database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The RUs per second of the parameters to provide for the current Gremlin database. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateGremlinDatabaseThroughputAsync(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateGremlinDatabaseThroughputRequest(resourceGroupName, accountName, databaseName, updateThroughputParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update RUs per second of an Azure Cosmos DB Gremlin database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The RUs per second of the parameters to provide for the current Gremlin database. + /// The cancellation token to use. + /// , , , or is null. + public Response UpdateGremlinDatabaseThroughput(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateGremlinDatabaseThroughputRequest(resourceGroupName, accountName, databaseName, updateThroughputParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateGremlinDatabaseToAutoscaleRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task MigrateGremlinDatabaseToAutoscaleAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateMigrateGremlinDatabaseToAutoscaleRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response MigrateGremlinDatabaseToAutoscale(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateMigrateGremlinDatabaseToAutoscaleRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateGremlinDatabaseToManualThroughputRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task MigrateGremlinDatabaseToManualThroughputAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateMigrateGremlinDatabaseToManualThroughputRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response MigrateGremlinDatabaseToManualThroughput(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateMigrateGremlinDatabaseToManualThroughputRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListGremlinGraphsRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/graphs", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the Gremlin graph under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListGremlinGraphsAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListGremlinGraphsRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GremlinGraphListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GremlinGraphListResult.DeserializeGremlinGraphListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the Gremlin graph under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response ListGremlinGraphs(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListGremlinGraphsRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GremlinGraphListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GremlinGraphListResult.DeserializeGremlinGraphListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetGremlinGraphRequest(string resourceGroupName, string accountName, string databaseName, string graphName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/graphs/", false); + uri.AppendPath(graphName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the Gremlin graph under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetGremlinGraphAsync(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateGetGremlinGraphRequest(resourceGroupName, accountName, databaseName, graphName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GremlinGraphGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GremlinGraphGetResults.DeserializeGremlinGraphGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the Gremlin graph under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public Response GetGremlinGraph(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateGetGremlinGraphRequest(resourceGroupName, accountName, databaseName, graphName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GremlinGraphGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GremlinGraphGetResults.DeserializeGremlinGraphGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateGremlinGraphRequest(string resourceGroupName, string accountName, string databaseName, string graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/graphs/", false); + uri.AppendPath(graphName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateGremlinGraphParameters); + request.Content = content; + return message; + } + + /// Create or update an Azure Cosmos DB Gremlin graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The parameters to provide for the current Gremlin graph. + /// The cancellation token to use. + /// , , , , or is null. + public async Task CreateUpdateGremlinGraphAsync(string resourceGroupName, string accountName, string databaseName, string graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + if (createUpdateGremlinGraphParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateGremlinGraphParameters)); + } + + using var message = CreateCreateUpdateGremlinGraphRequest(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an Azure Cosmos DB Gremlin graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The parameters to provide for the current Gremlin graph. + /// The cancellation token to use. + /// , , , , or is null. + public Response CreateUpdateGremlinGraph(string resourceGroupName, string accountName, string databaseName, string graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + if (createUpdateGremlinGraphParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateGremlinGraphParameters)); + } + + using var message = CreateCreateUpdateGremlinGraphRequest(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteGremlinGraphRequest(string resourceGroupName, string accountName, string databaseName, string graphName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/graphs/", false); + uri.AppendPath(graphName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB Gremlin graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public async Task DeleteGremlinGraphAsync(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateDeleteGremlinGraphRequest(resourceGroupName, accountName, databaseName, graphName); + 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 an existing Azure Cosmos DB Gremlin graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public Response DeleteGremlinGraph(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateDeleteGremlinGraphRequest(resourceGroupName, accountName, databaseName, graphName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetGremlinGraphThroughputRequest(string resourceGroupName, string accountName, string databaseName, string graphName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/graphs/", false); + uri.AppendPath(graphName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetGremlinGraphThroughputAsync(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateGetGremlinGraphThroughputRequest(resourceGroupName, accountName, databaseName, graphName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public Response GetGremlinGraphThroughput(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateGetGremlinGraphThroughputRequest(resourceGroupName, accountName, databaseName, graphName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateGremlinGraphThroughputRequest(string resourceGroupName, string accountName, string databaseName, string graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/graphs/", false); + uri.AppendPath(graphName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateThroughputParameters); + request.Content = content; + return message; + } + + /// Update RUs per second of an Azure Cosmos DB Gremlin graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The RUs per second of the parameters to provide for the current Gremlin graph. + /// The cancellation token to use. + /// , , , , or is null. + public async Task UpdateGremlinGraphThroughputAsync(string resourceGroupName, string accountName, string databaseName, string graphName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateGremlinGraphThroughputRequest(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update RUs per second of an Azure Cosmos DB Gremlin graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The RUs per second of the parameters to provide for the current Gremlin graph. + /// The cancellation token to use. + /// , , , , or is null. + public Response UpdateGremlinGraphThroughput(string resourceGroupName, string accountName, string databaseName, string graphName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateGremlinGraphThroughputRequest(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateGremlinGraphToAutoscaleRequest(string resourceGroupName, string accountName, string databaseName, string graphName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/graphs/", false); + uri.AppendPath(graphName, true); + uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public async Task MigrateGremlinGraphToAutoscaleAsync(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateMigrateGremlinGraphToAutoscaleRequest(resourceGroupName, accountName, databaseName, graphName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public Response MigrateGremlinGraphToAutoscale(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateMigrateGremlinGraphToAutoscaleRequest(resourceGroupName, accountName, databaseName, graphName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateGremlinGraphToManualThroughputRequest(string resourceGroupName, string accountName, string databaseName, string graphName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/gremlinDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/graphs/", false); + uri.AppendPath(graphName, true); + uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public async Task MigrateGremlinGraphToManualThroughputAsync(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateMigrateGremlinGraphToManualThroughputRequest(resourceGroupName, accountName, databaseName, graphName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB graph name. + /// The cancellation token to use. + /// , , , or is null. + public Response MigrateGremlinGraphToManualThroughput(string resourceGroupName, string accountName, string databaseName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateMigrateGremlinGraphToManualThroughputRequest(resourceGroupName, accountName, databaseName, graphName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesUpdateGremlinDatabaseThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesUpdateGremlinDatabaseThroughputOperation.cs new file mode 100644 index 000000000000..2080f93e5950 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesUpdateGremlinDatabaseThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Update RUs per second of an Azure Cosmos DB Gremlin database. + public partial class GremlinResourcesUpdateGremlinDatabaseThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal GremlinResourcesUpdateGremlinDatabaseThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GremlinResourcesUpdateGremlinDatabaseThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesUpdateGremlinGraphThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesUpdateGremlinGraphThroughputOperation.cs new file mode 100644 index 000000000000..eb8c590bbe17 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesUpdateGremlinGraphThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Update RUs per second of an Azure Cosmos DB Gremlin graph. + public partial class GremlinResourcesUpdateGremlinGraphThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal GremlinResourcesUpdateGremlinGraphThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GremlinResourcesUpdateGremlinGraphThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMProxyResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMProxyResource.Serialization.cs new file mode 100644 index 000000000000..6459c0b9d2df --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMProxyResource.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ARMProxyResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static ARMProxyResource DeserializeARMProxyResource(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new ARMProxyResource(id.Value, name.Value, type.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMProxyResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMProxyResource.cs new file mode 100644 index 000000000000..36a1c1932533 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMProxyResource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + public partial class ARMProxyResource + { + /// Initializes a new instance of ARMProxyResource. + public ARMProxyResource() + { + } + + /// Initializes a new instance of ARMProxyResource. + /// The unique resource identifier of the database account. + /// The name of the database account. + /// The type of Azure resource. + internal ARMProxyResource(string id, string name, string type) + { + Id = id; + Name = name; + Type = type; + } + + /// The unique resource identifier of the database account. + public string Id { get; } + /// The name of the database account. + public string Name { get; } + /// The type of Azure resource. + public string Type { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.Serialization.cs new file mode 100644 index 000000000000..4586b308e931 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.Serialization.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ARMResourceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static ARMResourceProperties DeserializeARMResourceProperties(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + } + return new ARMResourceProperties(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.cs new file mode 100644 index 000000000000..d175530d42e3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The core properties of ARM resources. + public partial class ARMResourceProperties + { + /// Initializes a new instance of ARMResourceProperties. + public ARMResourceProperties() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of ARMResourceProperties. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + internal ARMResourceProperties(string id, string name, string type, string location, IDictionary tags) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + } + + /// The unique resource identifier of the ARM resource. + public string Id { get; } + /// The name of the ARM resource. + public string Name { get; } + /// The type of Azure resource. + public string Type { get; } + /// The location of the resource group to which the resource belongs. + public string Location { get; set; } + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + public IDictionary Tags { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.Serialization.cs new file mode 100644 index 000000000000..44ca5605c47f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ApiProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ServerVersion)) + { + writer.WritePropertyName("serverVersion"); + writer.WriteStringValue(ServerVersion.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static ApiProperties DeserializeApiProperties(JsonElement element) + { + Optional serverVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("serverVersion")) + { + serverVersion = new ServerVersion(property.Value.GetString()); + continue; + } + } + return new ApiProperties(Optional.ToNullable(serverVersion)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.cs new file mode 100644 index 000000000000..ba11e32765e7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The ApiProperties. + public partial class ApiProperties + { + /// Initializes a new instance of ApiProperties. + public ApiProperties() + { + } + + /// Initializes a new instance of ApiProperties. + /// Describes the ServerVersion of an a MongoDB account. + internal ApiProperties(ServerVersion? serverVersion) + { + ServerVersion = serverVersion; + } + + /// Describes the ServerVersion of an a MongoDB account. + public ServerVersion? ServerVersion { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResource.Serialization.cs new file mode 100644 index 000000000000..d9dcbaec93b0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResource.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class AutoUpgradePolicyResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ThroughputPolicy)) + { + writer.WritePropertyName("throughputPolicy"); + writer.WriteObjectValue(ThroughputPolicy); + } + writer.WriteEndObject(); + } + + internal static AutoUpgradePolicyResource DeserializeAutoUpgradePolicyResource(JsonElement element) + { + Optional throughputPolicy = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughputPolicy")) + { + throughputPolicy = ThroughputPolicyResource.DeserializeThroughputPolicyResource(property.Value); + continue; + } + } + return new AutoUpgradePolicyResource(throughputPolicy.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResource.cs new file mode 100644 index 000000000000..672f5cd1f0b7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResource.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB resource auto-upgrade policy. + public partial class AutoUpgradePolicyResource + { + /// Initializes a new instance of AutoUpgradePolicyResource. + public AutoUpgradePolicyResource() + { + } + + /// Initializes a new instance of AutoUpgradePolicyResource. + /// Represents throughput policy which service must adhere to for auto-upgrade. + internal AutoUpgradePolicyResource(ThroughputPolicyResource throughputPolicy) + { + ThroughputPolicy = throughputPolicy; + } + + /// Represents throughput policy which service must adhere to for auto-upgrade. + public ThroughputPolicyResource ThroughputPolicy { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.Serialization.cs new file mode 100644 index 000000000000..591bd87a2fa4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class AutoscaleSettings : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(MaxThroughput)) + { + writer.WritePropertyName("maxThroughput"); + writer.WriteNumberValue(MaxThroughput.Value); + } + writer.WriteEndObject(); + } + + internal static AutoscaleSettings DeserializeAutoscaleSettings(JsonElement element) + { + Optional maxThroughput = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("maxThroughput")) + { + maxThroughput = property.Value.GetInt32(); + continue; + } + } + return new AutoscaleSettings(Optional.ToNullable(maxThroughput)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.cs new file mode 100644 index 000000000000..ad1e3fbae3f2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The AutoscaleSettings. + public partial class AutoscaleSettings + { + /// Initializes a new instance of AutoscaleSettings. + public AutoscaleSettings() + { + } + + /// Initializes a new instance of AutoscaleSettings. + /// Represents maximum throughput, the resource can scale up to. + internal AutoscaleSettings(int? maxThroughput) + { + MaxThroughput = maxThroughput; + } + + /// Represents maximum throughput, the resource can scale up to. + public int? MaxThroughput { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResource.Serialization.cs new file mode 100644 index 000000000000..caa9cb64f1af --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResource.Serialization.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class AutoscaleSettingsResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("maxThroughput"); + writer.WriteNumberValue(MaxThroughput); + if (Optional.IsDefined(AutoUpgradePolicy)) + { + writer.WritePropertyName("autoUpgradePolicy"); + writer.WriteObjectValue(AutoUpgradePolicy); + } + writer.WriteEndObject(); + } + + internal static AutoscaleSettingsResource DeserializeAutoscaleSettingsResource(JsonElement element) + { + int maxThroughput = default; + Optional autoUpgradePolicy = default; + Optional targetMaxThroughput = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("maxThroughput")) + { + maxThroughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoUpgradePolicy")) + { + autoUpgradePolicy = AutoUpgradePolicyResource.DeserializeAutoUpgradePolicyResource(property.Value); + continue; + } + if (property.NameEquals("targetMaxThroughput")) + { + targetMaxThroughput = property.Value.GetInt32(); + continue; + } + } + return new AutoscaleSettingsResource(maxThroughput, autoUpgradePolicy.Value, Optional.ToNullable(targetMaxThroughput)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResource.cs new file mode 100644 index 000000000000..8cc4c413114d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB provisioned throughput settings object. + public partial class AutoscaleSettingsResource + { + /// Initializes a new instance of AutoscaleSettingsResource. + /// Represents maximum throughput container can scale up to. + public AutoscaleSettingsResource(int maxThroughput) + { + MaxThroughput = maxThroughput; + } + + /// Initializes a new instance of AutoscaleSettingsResource. + /// Represents maximum throughput container can scale up to. + /// Cosmos DB resource auto-upgrade policy. + /// Represents target maximum throughput container can scale up to once offer is no longer in pending state. + internal AutoscaleSettingsResource(int maxThroughput, AutoUpgradePolicyResource autoUpgradePolicy, int? targetMaxThroughput) + { + MaxThroughput = maxThroughput; + AutoUpgradePolicy = autoUpgradePolicy; + TargetMaxThroughput = targetMaxThroughput; + } + + /// Represents maximum throughput container can scale up to. + public int MaxThroughput { get; set; } + /// Cosmos DB resource auto-upgrade policy. + public AutoUpgradePolicyResource AutoUpgradePolicy { get; set; } + /// Represents target maximum throughput container can scale up to once offer is no longer in pending state. + public int? TargetMaxThroughput { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Capability.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Capability.Serialization.cs new file mode 100644 index 000000000000..e9aa1a966893 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Capability.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class Capability : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + writer.WriteEndObject(); + } + + internal static Capability DeserializeCapability(JsonElement element) + { + Optional name = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + } + return new Capability(name.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Capability.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Capability.cs new file mode 100644 index 000000000000..0fae412f4cc2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Capability.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB capability object. + public partial class Capability + { + /// Initializes a new instance of Capability. + public Capability() + { + } + + /// Initializes a new instance of Capability. + /// Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". + internal Capability(string name) + { + Name = name; + } + + /// Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". + public string Name { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..0c7bb496b6d7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.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.ResourceManager.CosmosDB.Models +{ + public partial class CassandraKeyspaceCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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("resource"); + writer.WriteObjectValue(Resource); + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static CassandraKeyspaceCreateUpdateParameters DeserializeCassandraKeyspaceCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + CassandraKeyspaceResource resource = default; + CreateUpdateOptions options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = CassandraKeyspaceResource.DeserializeCassandraKeyspaceResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new CassandraKeyspaceCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.cs new file mode 100644 index 000000000000..1bbda50440fe --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB Cassandra keyspace. + public partial class CassandraKeyspaceCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of CassandraKeyspaceCreateUpdateParameters. + /// The standard JSON format of a Cassandra keyspace. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + /// or is null. + public CassandraKeyspaceCreateUpdateParameters(CassandraKeyspaceResource resource, CreateUpdateOptions options) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + Resource = resource; + Options = options; + } + + /// Initializes a new instance of CassandraKeyspaceCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The standard JSON format of a Cassandra keyspace. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal CassandraKeyspaceCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, CassandraKeyspaceResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a Cassandra keyspace. + public CassandraKeyspaceResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesOptions.Serialization.cs new file mode 100644 index 000000000000..2d440e40057c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesOptions.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraKeyspaceGetPropertiesOptions + { + internal static CassandraKeyspaceGetPropertiesOptions DeserializeCassandraKeyspaceGetPropertiesOptions(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); + continue; + } + } + return new CassandraKeyspaceGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesOptions.cs new file mode 100644 index 000000000000..43d85de26c95 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesOptions.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The CassandraKeyspaceGetPropertiesOptions. + public partial class CassandraKeyspaceGetPropertiesOptions : OptionsResource + { + /// Initializes a new instance of CassandraKeyspaceGetPropertiesOptions. + internal CassandraKeyspaceGetPropertiesOptions() + { + } + + /// Initializes a new instance of CassandraKeyspaceGetPropertiesOptions. + /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. + /// Specifies the Autoscale settings. + internal CassandraKeyspaceGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..d143ce2852ed --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraKeyspaceGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WriteEndObject(); + } + + internal static CassandraKeyspaceGetPropertiesResource DeserializeCassandraKeyspaceGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new CassandraKeyspaceGetPropertiesResource(id, Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.cs new file mode 100644 index 000000000000..45e2c3d9a901 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The CassandraKeyspaceGetPropertiesResource. + public partial class CassandraKeyspaceGetPropertiesResource : CassandraKeyspaceResource + { + /// Initializes a new instance of CassandraKeyspaceGetPropertiesResource. + /// Name of the Cosmos DB Cassandra keyspace. + /// is null. + public CassandraKeyspaceGetPropertiesResource(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of CassandraKeyspaceGetPropertiesResource. + /// Name of the Cosmos DB Cassandra keyspace. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + /// is null. + internal CassandraKeyspaceGetPropertiesResource(string id, string rid, object ts, string etag) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.Serialization.cs new file mode 100644 index 000000000000..238038114020 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.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.ResourceManager.CosmosDB.Models +{ + public partial class CassandraKeyspaceGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static CassandraKeyspaceGetResults DeserializeCassandraKeyspaceGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional resource = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = CassandraKeyspaceGetPropertiesResource.DeserializeCassandraKeyspaceGetPropertiesResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = OptionsResource.DeserializeOptionsResource(property0.Value); + continue; + } + } + continue; + } + } + return new CassandraKeyspaceGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.cs new file mode 100644 index 000000000000..00050adb96cc --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.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.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB Cassandra keyspace. + public partial class CassandraKeyspaceGetResults : ARMResourceProperties + { + /// Initializes a new instance of CassandraKeyspaceGetResults. + public CassandraKeyspaceGetResults() + { + } + + /// Initializes a new instance of CassandraKeyspaceGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// . + /// Cosmos DB options resource object. + internal CassandraKeyspaceGetResults(string id, string name, string type, string location, IDictionary tags, CassandraKeyspaceGetPropertiesResource resource, OptionsResource options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + public CassandraKeyspaceGetPropertiesResource Resource { get; set; } + /// Cosmos DB options resource object. + public OptionsResource Options { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.Serialization.cs new file mode 100644 index 000000000000..f6beb30f8518 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraKeyspaceListResult + { + internal static CassandraKeyspaceListResult DeserializeCassandraKeyspaceListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CassandraKeyspaceGetResults.DeserializeCassandraKeyspaceGetResults(item)); + } + value = array; + continue; + } + } + return new CassandraKeyspaceListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.cs new file mode 100644 index 000000000000..bd764bf088eb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the Cassandra keyspaces and their properties. + public partial class CassandraKeyspaceListResult + { + /// Initializes a new instance of CassandraKeyspaceListResult. + internal CassandraKeyspaceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of CassandraKeyspaceListResult. + /// List of Cassandra keyspaces and their properties. + internal CassandraKeyspaceListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of Cassandra keyspaces and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResource.Serialization.cs new file mode 100644 index 000000000000..a00f0b880c37 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResource.Serialization.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraKeyspaceResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WriteEndObject(); + } + + internal static CassandraKeyspaceResource DeserializeCassandraKeyspaceResource(JsonElement element) + { + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new CassandraKeyspaceResource(id); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResource.cs new file mode 100644 index 000000000000..c56d710bb206 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB Cassandra keyspace resource object. + public partial class CassandraKeyspaceResource + { + /// Initializes a new instance of CassandraKeyspaceResource. + /// Name of the Cosmos DB Cassandra keyspace. + /// is null. + public CassandraKeyspaceResource(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + } + + /// Name of the Cosmos DB Cassandra keyspace. + public string Id { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.Serialization.cs new file mode 100644 index 000000000000..b89f76894372 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraPartitionKey : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + writer.WriteEndObject(); + } + + internal static CassandraPartitionKey DeserializeCassandraPartitionKey(JsonElement element) + { + Optional name = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + } + return new CassandraPartitionKey(name.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.cs new file mode 100644 index 000000000000..241bb78e9a01 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB Cassandra table partition key. + public partial class CassandraPartitionKey + { + /// Initializes a new instance of CassandraPartitionKey. + public CassandraPartitionKey() + { + } + + /// Initializes a new instance of CassandraPartitionKey. + /// Name of the Cosmos DB Cassandra table partition key. + internal CassandraPartitionKey(string name) + { + Name = name; + } + + /// Name of the Cosmos DB Cassandra table partition key. + public string Name { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.Serialization.cs new file mode 100644 index 000000000000..90a90cb94a38 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.Serialization.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraSchema : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Columns)) + { + writer.WritePropertyName("columns"); + writer.WriteStartArray(); + foreach (var item in Columns) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(PartitionKeys)) + { + writer.WritePropertyName("partitionKeys"); + writer.WriteStartArray(); + foreach (var item in PartitionKeys) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ClusterKeys)) + { + writer.WritePropertyName("clusterKeys"); + writer.WriteStartArray(); + foreach (var item in ClusterKeys) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static CassandraSchema DeserializeCassandraSchema(JsonElement element) + { + Optional> columns = default; + Optional> partitionKeys = default; + Optional> clusterKeys = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("columns")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Column.DeserializeColumn(item)); + } + columns = array; + continue; + } + if (property.NameEquals("partitionKeys")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CassandraPartitionKey.DeserializeCassandraPartitionKey(item)); + } + partitionKeys = array; + continue; + } + if (property.NameEquals("clusterKeys")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ClusterKey.DeserializeClusterKey(item)); + } + clusterKeys = array; + continue; + } + } + return new CassandraSchema(Optional.ToList(columns), Optional.ToList(partitionKeys), Optional.ToList(clusterKeys)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.cs new file mode 100644 index 000000000000..e9f07fbc9929 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB Cassandra table schema. + public partial class CassandraSchema + { + /// Initializes a new instance of CassandraSchema. + public CassandraSchema() + { + Columns = new ChangeTrackingList(); + PartitionKeys = new ChangeTrackingList(); + ClusterKeys = new ChangeTrackingList(); + } + + /// Initializes a new instance of CassandraSchema. + /// List of Cassandra table columns. + /// List of partition key. + /// List of cluster key. + internal CassandraSchema(IList columns, IList partitionKeys, IList clusterKeys) + { + Columns = columns; + PartitionKeys = partitionKeys; + ClusterKeys = clusterKeys; + } + + /// List of Cassandra table columns. + public IList Columns { get; } + /// List of partition key. + public IList PartitionKeys { get; } + /// List of cluster key. + public IList ClusterKeys { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..138d3f0b58ab --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.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.ResourceManager.CosmosDB.Models +{ + public partial class CassandraTableCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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("resource"); + writer.WriteObjectValue(Resource); + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static CassandraTableCreateUpdateParameters DeserializeCassandraTableCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + CassandraTableResource resource = default; + CreateUpdateOptions options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = CassandraTableResource.DeserializeCassandraTableResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new CassandraTableCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.cs new file mode 100644 index 000000000000..b7eaa5f12c2a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB Cassandra table. + public partial class CassandraTableCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of CassandraTableCreateUpdateParameters. + /// The standard JSON format of a Cassandra table. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + /// or is null. + public CassandraTableCreateUpdateParameters(CassandraTableResource resource, CreateUpdateOptions options) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + Resource = resource; + Options = options; + } + + /// Initializes a new instance of CassandraTableCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The standard JSON format of a Cassandra table. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal CassandraTableCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, CassandraTableResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a Cassandra table. + public CassandraTableResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesOptions.Serialization.cs new file mode 100644 index 000000000000..2f08da2ac5ed --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesOptions.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraTableGetPropertiesOptions + { + internal static CassandraTableGetPropertiesOptions DeserializeCassandraTableGetPropertiesOptions(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); + continue; + } + } + return new CassandraTableGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesOptions.cs new file mode 100644 index 000000000000..9130700efa2f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesOptions.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The CassandraTableGetPropertiesOptions. + public partial class CassandraTableGetPropertiesOptions : OptionsResource + { + /// Initializes a new instance of CassandraTableGetPropertiesOptions. + internal CassandraTableGetPropertiesOptions() + { + } + + /// Initializes a new instance of CassandraTableGetPropertiesOptions. + /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. + /// Specifies the Autoscale settings. + internal CassandraTableGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..d3a2142beee9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.Serialization.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraTableGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsDefined(DefaultTtl)) + { + writer.WritePropertyName("defaultTtl"); + writer.WriteNumberValue(DefaultTtl.Value); + } + if (Optional.IsDefined(Schema)) + { + writer.WritePropertyName("schema"); + writer.WriteObjectValue(Schema); + } + if (Optional.IsDefined(AnalyticalStorageTtl)) + { + writer.WritePropertyName("analyticalStorageTtl"); + writer.WriteNumberValue(AnalyticalStorageTtl.Value); + } + writer.WriteEndObject(); + } + + internal static CassandraTableGetPropertiesResource DeserializeCassandraTableGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + Optional defaultTtl = default; + Optional schema = default; + Optional analyticalStorageTtl = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultTtl")) + { + defaultTtl = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("schema")) + { + schema = CassandraSchema.DeserializeCassandraSchema(property.Value); + continue; + } + if (property.NameEquals("analyticalStorageTtl")) + { + analyticalStorageTtl = property.Value.GetInt32(); + continue; + } + } + return new CassandraTableGetPropertiesResource(id, Optional.ToNullable(defaultTtl), schema.Value, Optional.ToNullable(analyticalStorageTtl), Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.cs new file mode 100644 index 000000000000..1836d9c92ea0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The CassandraTableGetPropertiesResource. + public partial class CassandraTableGetPropertiesResource : CassandraTableResource + { + /// Initializes a new instance of CassandraTableGetPropertiesResource. + /// Name of the Cosmos DB Cassandra table. + /// is null. + public CassandraTableGetPropertiesResource(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of CassandraTableGetPropertiesResource. + /// Name of the Cosmos DB Cassandra table. + /// Time to live of the Cosmos DB Cassandra table. + /// Schema of the Cosmos DB Cassandra table. + /// Analytical TTL. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + internal CassandraTableGetPropertiesResource(string id, int? defaultTtl, CassandraSchema schema, int? analyticalStorageTtl, string rid, object ts, string etag) : base(id, defaultTtl, schema, analyticalStorageTtl) + { + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.Serialization.cs new file mode 100644 index 000000000000..ac856f1d78af --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.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.ResourceManager.CosmosDB.Models +{ + public partial class CassandraTableGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static CassandraTableGetResults DeserializeCassandraTableGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional resource = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = CassandraTableGetPropertiesResource.DeserializeCassandraTableGetPropertiesResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = OptionsResource.DeserializeOptionsResource(property0.Value); + continue; + } + } + continue; + } + } + return new CassandraTableGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.cs new file mode 100644 index 000000000000..6f19e466f7ac --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.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.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB Cassandra table. + public partial class CassandraTableGetResults : ARMResourceProperties + { + /// Initializes a new instance of CassandraTableGetResults. + public CassandraTableGetResults() + { + } + + /// Initializes a new instance of CassandraTableGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// . + /// Cosmos DB options resource object. + internal CassandraTableGetResults(string id, string name, string type, string location, IDictionary tags, CassandraTableGetPropertiesResource resource, OptionsResource options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + public CassandraTableGetPropertiesResource Resource { get; set; } + /// Cosmos DB options resource object. + public OptionsResource Options { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.Serialization.cs new file mode 100644 index 000000000000..12a6c5af1c2e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraTableListResult + { + internal static CassandraTableListResult DeserializeCassandraTableListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CassandraTableGetResults.DeserializeCassandraTableGetResults(item)); + } + value = array; + continue; + } + } + return new CassandraTableListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.cs new file mode 100644 index 000000000000..63c18a507992 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the Cassandra tables and their properties. + public partial class CassandraTableListResult + { + /// Initializes a new instance of CassandraTableListResult. + internal CassandraTableListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of CassandraTableListResult. + /// List of Cassandra tables and their properties. + internal CassandraTableListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of Cassandra tables and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResource.Serialization.cs new file mode 100644 index 000000000000..79f3fb606609 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResource.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraTableResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsDefined(DefaultTtl)) + { + writer.WritePropertyName("defaultTtl"); + writer.WriteNumberValue(DefaultTtl.Value); + } + if (Optional.IsDefined(Schema)) + { + writer.WritePropertyName("schema"); + writer.WriteObjectValue(Schema); + } + if (Optional.IsDefined(AnalyticalStorageTtl)) + { + writer.WritePropertyName("analyticalStorageTtl"); + writer.WriteNumberValue(AnalyticalStorageTtl.Value); + } + writer.WriteEndObject(); + } + + internal static CassandraTableResource DeserializeCassandraTableResource(JsonElement element) + { + string id = default; + Optional defaultTtl = default; + Optional schema = default; + Optional analyticalStorageTtl = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultTtl")) + { + defaultTtl = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("schema")) + { + schema = CassandraSchema.DeserializeCassandraSchema(property.Value); + continue; + } + if (property.NameEquals("analyticalStorageTtl")) + { + analyticalStorageTtl = property.Value.GetInt32(); + continue; + } + } + return new CassandraTableResource(id, Optional.ToNullable(defaultTtl), schema.Value, Optional.ToNullable(analyticalStorageTtl)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResource.cs new file mode 100644 index 000000000000..f052951e40f7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResource.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB Cassandra table resource object. + public partial class CassandraTableResource + { + /// Initializes a new instance of CassandraTableResource. + /// Name of the Cosmos DB Cassandra table. + /// is null. + public CassandraTableResource(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + } + + /// Initializes a new instance of CassandraTableResource. + /// Name of the Cosmos DB Cassandra table. + /// Time to live of the Cosmos DB Cassandra table. + /// Schema of the Cosmos DB Cassandra table. + /// Analytical TTL. + internal CassandraTableResource(string id, int? defaultTtl, CassandraSchema schema, int? analyticalStorageTtl) + { + Id = id; + DefaultTtl = defaultTtl; + Schema = schema; + AnalyticalStorageTtl = analyticalStorageTtl; + } + + /// Name of the Cosmos DB Cassandra table. + public string Id { get; set; } + /// Time to live of the Cosmos DB Cassandra table. + public int? DefaultTtl { get; set; } + /// Schema of the Cosmos DB Cassandra table. + public CassandraSchema Schema { get; set; } + /// Analytical TTL. + public int? AnalyticalStorageTtl { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterKey.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterKey.Serialization.cs new file mode 100644 index 000000000000..c6cd38d1cfd9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterKey.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ClusterKey : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(OrderBy)) + { + writer.WritePropertyName("orderBy"); + writer.WriteStringValue(OrderBy); + } + writer.WriteEndObject(); + } + + internal static ClusterKey DeserializeClusterKey(JsonElement element) + { + Optional name = default; + Optional orderBy = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("orderBy")) + { + orderBy = property.Value.GetString(); + continue; + } + } + return new ClusterKey(name.Value, orderBy.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterKey.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterKey.cs new file mode 100644 index 000000000000..e50cb3e02128 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterKey.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB Cassandra table cluster key. + public partial class ClusterKey + { + /// Initializes a new instance of ClusterKey. + public ClusterKey() + { + } + + /// Initializes a new instance of ClusterKey. + /// Name of the Cosmos DB Cassandra table cluster key. + /// Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc". + internal ClusterKey(string name, string orderBy) + { + Name = name; + OrderBy = orderBy; + } + + /// Name of the Cosmos DB Cassandra table cluster key. + public string Name { get; set; } + /// Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc". + public string OrderBy { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Column.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Column.Serialization.cs new file mode 100644 index 000000000000..27f71a7c2f57 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Column.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class Column : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type); + } + writer.WriteEndObject(); + } + + internal static Column DeserializeColumn(JsonElement element) + { + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new Column(name.Value, type.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Column.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Column.cs new file mode 100644 index 000000000000..5794fbc82a9f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Column.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB Cassandra table column. + public partial class Column + { + /// Initializes a new instance of Column. + public Column() + { + } + + /// Initializes a new instance of Column. + /// Name of the Cosmos DB Cassandra table column. + /// Type of the Cosmos DB Cassandra table column. + internal Column(string name, string type) + { + Name = name; + Type = type; + } + + /// Name of the Cosmos DB Cassandra table column. + public string Name { get; set; } + /// Type of the Cosmos DB Cassandra table column. + public string Type { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CompositePath.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CompositePath.Serialization.cs new file mode 100644 index 000000000000..df5c1af6276c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CompositePath.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CompositePath : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"); + writer.WriteStringValue(Path); + } + if (Optional.IsDefined(Order)) + { + writer.WritePropertyName("order"); + writer.WriteStringValue(Order.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static CompositePath DeserializeCompositePath(JsonElement element) + { + Optional path = default; + Optional order = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("path")) + { + path = property.Value.GetString(); + continue; + } + if (property.NameEquals("order")) + { + order = new CompositePathSortOrder(property.Value.GetString()); + continue; + } + } + return new CompositePath(path.Value, Optional.ToNullable(order)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CompositePath.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CompositePath.cs new file mode 100644 index 000000000000..5aef53346b7e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CompositePath.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The CompositePath. + public partial class CompositePath + { + /// Initializes a new instance of CompositePath. + public CompositePath() + { + } + + /// Initializes a new instance of CompositePath. + /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + /// Sort order for composite paths. + internal CompositePath(string path, CompositePathSortOrder? order) + { + Path = path; + Order = order; + } + + /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + public string Path { get; set; } + /// Sort order for composite paths. + public CompositePathSortOrder? Order { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CompositePathSortOrder.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CompositePathSortOrder.cs new file mode 100644 index 000000000000..32a704c697ea --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CompositePathSortOrder.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Sort order for composite paths. + public readonly partial struct CompositePathSortOrder : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public CompositePathSortOrder(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AscendingValue = "Ascending"; + private const string DescendingValue = "Descending"; + + /// Ascending. + public static CompositePathSortOrder Ascending { get; } = new CompositePathSortOrder(AscendingValue); + /// Descending. + public static CompositePathSortOrder Descending { get; } = new CompositePathSortOrder(DescendingValue); + /// Determines if two values are the same. + public static bool operator ==(CompositePathSortOrder left, CompositePathSortOrder right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CompositePathSortOrder left, CompositePathSortOrder right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CompositePathSortOrder(string value) => new CompositePathSortOrder(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CompositePathSortOrder other && Equals(other); + /// + public bool Equals(CompositePathSortOrder 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionMode.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionMode.cs new file mode 100644 index 000000000000..0678daa5889f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Indicates the conflict resolution mode. + public readonly partial struct ConflictResolutionMode : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ConflictResolutionMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LastWriterWinsValue = "LastWriterWins"; + private const string CustomValue = "Custom"; + + /// LastWriterWins. + public static ConflictResolutionMode LastWriterWins { get; } = new ConflictResolutionMode(LastWriterWinsValue); + /// Custom. + public static ConflictResolutionMode Custom { get; } = new ConflictResolutionMode(CustomValue); + /// Determines if two values are the same. + public static bool operator ==(ConflictResolutionMode left, ConflictResolutionMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ConflictResolutionMode left, ConflictResolutionMode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ConflictResolutionMode(string value) => new ConflictResolutionMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConflictResolutionMode other && Equals(other); + /// + public bool Equals(ConflictResolutionMode 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.Serialization.cs new file mode 100644 index 000000000000..402f9b8fa650 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ConflictResolutionPolicy : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (Optional.IsDefined(ConflictResolutionPath)) + { + writer.WritePropertyName("conflictResolutionPath"); + writer.WriteStringValue(ConflictResolutionPath); + } + if (Optional.IsDefined(ConflictResolutionProcedure)) + { + writer.WritePropertyName("conflictResolutionProcedure"); + writer.WriteStringValue(ConflictResolutionProcedure); + } + writer.WriteEndObject(); + } + + internal static ConflictResolutionPolicy DeserializeConflictResolutionPolicy(JsonElement element) + { + Optional mode = default; + Optional conflictResolutionPath = default; + Optional conflictResolutionProcedure = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode")) + { + mode = new ConflictResolutionMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("conflictResolutionPath")) + { + conflictResolutionPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("conflictResolutionProcedure")) + { + conflictResolutionProcedure = property.Value.GetString(); + continue; + } + } + return new ConflictResolutionPolicy(Optional.ToNullable(mode), conflictResolutionPath.Value, conflictResolutionProcedure.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.cs new file mode 100644 index 000000000000..b44c27321ab4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The conflict resolution policy for the container. + public partial class ConflictResolutionPolicy + { + /// Initializes a new instance of ConflictResolutionPolicy. + public ConflictResolutionPolicy() + { + } + + /// Initializes a new instance of ConflictResolutionPolicy. + /// Indicates the conflict resolution mode. + /// The conflict resolution path in the case of LastWriterWins mode. + /// The procedure to resolve conflicts in the case of custom mode. + internal ConflictResolutionPolicy(ConflictResolutionMode? mode, string conflictResolutionPath, string conflictResolutionProcedure) + { + Mode = mode; + ConflictResolutionPath = conflictResolutionPath; + ConflictResolutionProcedure = conflictResolutionProcedure; + } + + /// Indicates the conflict resolution mode. + public ConflictResolutionMode? Mode { get; set; } + /// The conflict resolution path in the case of LastWriterWins mode. + public string ConflictResolutionPath { get; set; } + /// The procedure to resolve conflicts in the case of custom mode. + public string ConflictResolutionProcedure { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConnectorOffer.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConnectorOffer.cs new file mode 100644 index 000000000000..988d63b6b10a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConnectorOffer.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The cassandra connector offer type for the Cosmos DB C* database account. + public readonly partial struct ConnectorOffer : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ConnectorOffer(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SmallValue = "Small"; + + /// Small. + public static ConnectorOffer Small { get; } = new ConnectorOffer(SmallValue); + /// Determines if two values are the same. + public static bool operator ==(ConnectorOffer left, ConnectorOffer right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ConnectorOffer left, ConnectorOffer right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ConnectorOffer(string value) => new ConnectorOffer(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConnectorOffer other && Equals(other); + /// + public bool Equals(ConnectorOffer 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.Serialization.cs new file mode 100644 index 000000000000..08f9f502d526 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ConsistencyPolicy : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("defaultConsistencyLevel"); + writer.WriteStringValue(DefaultConsistencyLevel.ToSerialString()); + if (Optional.IsDefined(MaxStalenessPrefix)) + { + writer.WritePropertyName("maxStalenessPrefix"); + writer.WriteNumberValue(MaxStalenessPrefix.Value); + } + if (Optional.IsDefined(MaxIntervalInSeconds)) + { + writer.WritePropertyName("maxIntervalInSeconds"); + writer.WriteNumberValue(MaxIntervalInSeconds.Value); + } + writer.WriteEndObject(); + } + + internal static ConsistencyPolicy DeserializeConsistencyPolicy(JsonElement element) + { + DefaultConsistencyLevel defaultConsistencyLevel = default; + Optional maxStalenessPrefix = default; + Optional maxIntervalInSeconds = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("defaultConsistencyLevel")) + { + defaultConsistencyLevel = property.Value.GetString().ToDefaultConsistencyLevel(); + continue; + } + if (property.NameEquals("maxStalenessPrefix")) + { + maxStalenessPrefix = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("maxIntervalInSeconds")) + { + maxIntervalInSeconds = property.Value.GetInt32(); + continue; + } + } + return new ConsistencyPolicy(defaultConsistencyLevel, Optional.ToNullable(maxStalenessPrefix), Optional.ToNullable(maxIntervalInSeconds)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.cs new file mode 100644 index 000000000000..4524de1c1106 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The consistency policy for the Cosmos DB database account. + public partial class ConsistencyPolicy + { + /// Initializes a new instance of ConsistencyPolicy. + /// The default consistency level and configuration settings of the Cosmos DB account. + public ConsistencyPolicy(DefaultConsistencyLevel defaultConsistencyLevel) + { + DefaultConsistencyLevel = defaultConsistencyLevel; + } + + /// Initializes a new instance of ConsistencyPolicy. + /// The default consistency level and configuration settings of the Cosmos DB account. + /// When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + /// When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + internal ConsistencyPolicy(DefaultConsistencyLevel defaultConsistencyLevel, long? maxStalenessPrefix, int? maxIntervalInSeconds) + { + DefaultConsistencyLevel = defaultConsistencyLevel; + MaxStalenessPrefix = maxStalenessPrefix; + MaxIntervalInSeconds = maxIntervalInSeconds; + } + + /// The default consistency level and configuration settings of the Cosmos DB account. + public DefaultConsistencyLevel DefaultConsistencyLevel { get; set; } + /// When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + public long? MaxStalenessPrefix { get; set; } + /// When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + public int? MaxIntervalInSeconds { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.Serialization.cs new file mode 100644 index 000000000000..21686c5ba87c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.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.ResourceManager.CosmosDB.Models +{ + public partial class ContainerPartitionKey : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Paths)) + { + writer.WritePropertyName("paths"); + writer.WriteStartArray(); + foreach (var item in Paths) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind.Value.ToString()); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"); + writer.WriteNumberValue(Version.Value); + } + writer.WriteEndObject(); + } + + internal static ContainerPartitionKey DeserializeContainerPartitionKey(JsonElement element) + { + Optional> paths = default; + Optional kind = default; + Optional version = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("paths")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + paths = array; + continue; + } + if (property.NameEquals("kind")) + { + kind = new PartitionKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("version")) + { + version = property.Value.GetInt32(); + continue; + } + } + return new ContainerPartitionKey(Optional.ToList(paths), Optional.ToNullable(kind), Optional.ToNullable(version)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.cs new file mode 100644 index 000000000000..1065a196f4c7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The configuration of the partition key to be used for partitioning data into multiple partitions. + public partial class ContainerPartitionKey + { + /// Initializes a new instance of ContainerPartitionKey. + public ContainerPartitionKey() + { + Paths = new ChangeTrackingList(); + } + + /// Initializes a new instance of ContainerPartitionKey. + /// List of paths using which data within the container can be partitioned. + /// Indicates the kind of algorithm used for partitioning. + /// Indicates the version of the partition key definition. + internal ContainerPartitionKey(IList paths, PartitionKind? kind, int? version) + { + Paths = paths; + Kind = kind; + Version = version; + } + + /// List of paths using which data within the container can be partitioned. + public IList Paths { get; } + /// Indicates the kind of algorithm used for partitioning. + public PartitionKind? Kind { get; set; } + /// Indicates the version of the partition key definition. + public int? Version { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CorsPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CorsPolicy.Serialization.cs new file mode 100644 index 000000000000..b49881b7b00d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CorsPolicy.Serialization.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CorsPolicy : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("allowedOrigins"); + writer.WriteStringValue(AllowedOrigins); + if (Optional.IsDefined(AllowedMethods)) + { + writer.WritePropertyName("allowedMethods"); + writer.WriteStringValue(AllowedMethods); + } + if (Optional.IsDefined(AllowedHeaders)) + { + writer.WritePropertyName("allowedHeaders"); + writer.WriteStringValue(AllowedHeaders); + } + if (Optional.IsDefined(ExposedHeaders)) + { + writer.WritePropertyName("exposedHeaders"); + writer.WriteStringValue(ExposedHeaders); + } + if (Optional.IsDefined(MaxAgeInSeconds)) + { + writer.WritePropertyName("maxAgeInSeconds"); + writer.WriteNumberValue(MaxAgeInSeconds.Value); + } + writer.WriteEndObject(); + } + + internal static CorsPolicy DeserializeCorsPolicy(JsonElement element) + { + string allowedOrigins = default; + Optional allowedMethods = default; + Optional allowedHeaders = default; + Optional exposedHeaders = default; + Optional maxAgeInSeconds = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("allowedOrigins")) + { + allowedOrigins = property.Value.GetString(); + continue; + } + if (property.NameEquals("allowedMethods")) + { + allowedMethods = property.Value.GetString(); + continue; + } + if (property.NameEquals("allowedHeaders")) + { + allowedHeaders = property.Value.GetString(); + continue; + } + if (property.NameEquals("exposedHeaders")) + { + exposedHeaders = property.Value.GetString(); + continue; + } + if (property.NameEquals("maxAgeInSeconds")) + { + maxAgeInSeconds = property.Value.GetInt64(); + continue; + } + } + return new CorsPolicy(allowedOrigins, allowedMethods.Value, allowedHeaders.Value, exposedHeaders.Value, Optional.ToNullable(maxAgeInSeconds)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CorsPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CorsPolicy.cs new file mode 100644 index 000000000000..9c5b6612279a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CorsPolicy.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The CORS policy for the Cosmos DB database account. + public partial class CorsPolicy + { + /// Initializes a new instance of CorsPolicy. + /// The origin domains that are permitted to make a request against the service via CORS. + /// is null. + public CorsPolicy(string allowedOrigins) + { + if (allowedOrigins == null) + { + throw new ArgumentNullException(nameof(allowedOrigins)); + } + + AllowedOrigins = allowedOrigins; + } + + /// Initializes a new instance of CorsPolicy. + /// The origin domains that are permitted to make a request against the service via CORS. + /// The methods (HTTP request verbs) that the origin domain may use for a CORS request. + /// The request headers that the origin domain may specify on the CORS request. + /// The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. + /// The maximum amount time that a browser should cache the preflight OPTIONS request. + internal CorsPolicy(string allowedOrigins, string allowedMethods, string allowedHeaders, string exposedHeaders, long? maxAgeInSeconds) + { + AllowedOrigins = allowedOrigins; + AllowedMethods = allowedMethods; + AllowedHeaders = allowedHeaders; + ExposedHeaders = exposedHeaders; + MaxAgeInSeconds = maxAgeInSeconds; + } + + /// The origin domains that are permitted to make a request against the service via CORS. + public string AllowedOrigins { get; set; } + /// The methods (HTTP request verbs) that the origin domain may use for a CORS request. + public string AllowedMethods { get; set; } + /// The request headers that the origin domain may specify on the CORS request. + public string AllowedHeaders { get; set; } + /// The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. + public string ExposedHeaders { get; set; } + /// The maximum amount time that a browser should cache the preflight OPTIONS request. + public long? MaxAgeInSeconds { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CreateUpdateOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CreateUpdateOptions.Serialization.cs new file mode 100644 index 000000000000..f67641f98c95 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CreateUpdateOptions.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CreateUpdateOptions : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Throughput)) + { + writer.WritePropertyName("throughput"); + writer.WriteNumberValue(Throughput.Value); + } + if (Optional.IsDefined(AutoscaleSettings)) + { + writer.WritePropertyName("autoscaleSettings"); + writer.WriteObjectValue(AutoscaleSettings); + } + writer.WriteEndObject(); + } + + internal static CreateUpdateOptions DeserializeCreateUpdateOptions(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); + continue; + } + } + return new CreateUpdateOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CreateUpdateOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CreateUpdateOptions.cs new file mode 100644 index 000000000000..4208884c2a31 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CreateUpdateOptions.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput". + public partial class CreateUpdateOptions + { + /// Initializes a new instance of CreateUpdateOptions. + public CreateUpdateOptions() + { + } + + /// Initializes a new instance of CreateUpdateOptions. + /// Request Units per second. For example, "throughput": 10000. + /// Specifies the Autoscale settings. + internal CreateUpdateOptions(int? throughput, AutoscaleSettings autoscaleSettings) + { + Throughput = throughput; + AutoscaleSettings = autoscaleSettings; + } + + /// Request Units per second. For example, "throughput": 10000. + public int? Throughput { get; set; } + /// Specifies the Autoscale settings. + public AutoscaleSettings AutoscaleSettings { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataType.cs new file mode 100644 index 000000000000..62140cae09b9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataType.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The datatype for which the indexing behavior is applied to. + public readonly partial struct DataType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public DataType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StringValue = "String"; + private const string NumberValue = "Number"; + private const string PointValue = "Point"; + private const string PolygonValue = "Polygon"; + private const string LineStringValue = "LineString"; + private const string MultiPolygonValue = "MultiPolygon"; + + /// String. + public static DataType String { get; } = new DataType(StringValue); + /// Number. + public static DataType Number { get; } = new DataType(NumberValue); + /// Point. + public static DataType Point { get; } = new DataType(PointValue); + /// Polygon. + public static DataType Polygon { get; } = new DataType(PolygonValue); + /// LineString. + public static DataType LineString { get; } = new DataType(LineStringValue); + /// MultiPolygon. + public static DataType MultiPolygon { get; } = new DataType(MultiPolygonValue); + /// Determines if two values are the same. + public static bool operator ==(DataType left, DataType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataType left, DataType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DataType(string value) => new DataType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataType other && Equals(other); + /// + public bool Equals(DataType 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountConnectionString.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountConnectionString.Serialization.cs new file mode 100644 index 000000000000..199891682cff --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountConnectionString.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DatabaseAccountConnectionString + { + internal static DatabaseAccountConnectionString DeserializeDatabaseAccountConnectionString(JsonElement element) + { + Optional connectionString = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("connectionString")) + { + connectionString = property.Value.GetString(); + continue; + } + if (property.NameEquals("description")) + { + description = property.Value.GetString(); + continue; + } + } + return new DatabaseAccountConnectionString(connectionString.Value, description.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountConnectionString.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountConnectionString.cs new file mode 100644 index 000000000000..e8dfcb957386 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountConnectionString.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Connection string for the Cosmos DB account. + public partial class DatabaseAccountConnectionString + { + /// Initializes a new instance of DatabaseAccountConnectionString. + internal DatabaseAccountConnectionString() + { + } + + /// Initializes a new instance of DatabaseAccountConnectionString. + /// Value of the connection string. + /// Description of the connection string. + internal DatabaseAccountConnectionString(string connectionString, string description) + { + ConnectionString = connectionString; + Description = description; + } + + /// Value of the connection string. + public string ConnectionString { get; } + /// Description of the connection string. + public string Description { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..2e9703216c30 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.Serialization.cs @@ -0,0 +1,339 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DatabaseAccountCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind.Value.ToString()); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(ConsistencyPolicy)) + { + writer.WritePropertyName("consistencyPolicy"); + writer.WriteObjectValue(ConsistencyPolicy); + } + writer.WritePropertyName("locations"); + writer.WriteStartArray(); + foreach (var item in Locations) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("databaseAccountOfferType"); + writer.WriteStringValue(DatabaseAccountOfferType); + if (Optional.IsCollectionDefined(IpRules)) + { + writer.WritePropertyName("ipRules"); + writer.WriteStartArray(); + foreach (var item in IpRules) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(IsVirtualNetworkFilterEnabled)) + { + writer.WritePropertyName("isVirtualNetworkFilterEnabled"); + writer.WriteBooleanValue(IsVirtualNetworkFilterEnabled.Value); + } + if (Optional.IsDefined(EnableAutomaticFailover)) + { + writer.WritePropertyName("enableAutomaticFailover"); + writer.WriteBooleanValue(EnableAutomaticFailover.Value); + } + if (Optional.IsCollectionDefined(Capabilities)) + { + writer.WritePropertyName("capabilities"); + writer.WriteStartArray(); + foreach (var item in Capabilities) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(VirtualNetworkRules)) + { + writer.WritePropertyName("virtualNetworkRules"); + writer.WriteStartArray(); + foreach (var item in VirtualNetworkRules) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(EnableMultipleWriteLocations)) + { + writer.WritePropertyName("enableMultipleWriteLocations"); + writer.WriteBooleanValue(EnableMultipleWriteLocations.Value); + } + if (Optional.IsDefined(EnableCassandraConnector)) + { + writer.WritePropertyName("enableCassandraConnector"); + writer.WriteBooleanValue(EnableCassandraConnector.Value); + } + if (Optional.IsDefined(ConnectorOffer)) + { + writer.WritePropertyName("connectorOffer"); + writer.WriteStringValue(ConnectorOffer.Value.ToString()); + } + if (Optional.IsDefined(DisableKeyBasedMetadataWriteAccess)) + { + writer.WritePropertyName("disableKeyBasedMetadataWriteAccess"); + writer.WriteBooleanValue(DisableKeyBasedMetadataWriteAccess.Value); + } + if (Optional.IsDefined(KeyVaultKeyUri)) + { + writer.WritePropertyName("keyVaultKeyUri"); + writer.WriteStringValue(KeyVaultKeyUri); + } + if (Optional.IsDefined(EnableFreeTier)) + { + writer.WritePropertyName("enableFreeTier"); + writer.WriteBooleanValue(EnableFreeTier.Value); + } + if (Optional.IsDefined(ApiProperties)) + { + writer.WritePropertyName("apiProperties"); + writer.WriteObjectValue(ApiProperties); + } + if (Optional.IsDefined(EnableAnalyticalStorage)) + { + writer.WritePropertyName("enableAnalyticalStorage"); + writer.WriteBooleanValue(EnableAnalyticalStorage.Value); + } + if (Optional.IsCollectionDefined(Cors)) + { + writer.WritePropertyName("cors"); + writer.WriteStartArray(); + foreach (var item in Cors) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DatabaseAccountCreateUpdateParameters DeserializeDatabaseAccountCreateUpdateParameters(JsonElement element) + { + Optional kind = default; + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional consistencyPolicy = default; + IList locations = default; + string databaseAccountOfferType = default; + Optional> ipRules = default; + Optional isVirtualNetworkFilterEnabled = default; + Optional enableAutomaticFailover = default; + Optional> capabilities = default; + Optional> virtualNetworkRules = default; + Optional enableMultipleWriteLocations = default; + Optional enableCassandraConnector = default; + Optional connectorOffer = default; + Optional disableKeyBasedMetadataWriteAccess = default; + Optional keyVaultKeyUri = default; + Optional publicNetworkAccess = default; + Optional enableFreeTier = default; + Optional apiProperties = default; + Optional enableAnalyticalStorage = default; + Optional> cors = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind")) + { + kind = new DatabaseAccountKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("consistencyPolicy")) + { + consistencyPolicy = ConsistencyPolicy.DeserializeConsistencyPolicy(property0.Value); + continue; + } + if (property0.NameEquals("locations")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Models.Location.DeserializeLocation(item)); + } + locations = array; + continue; + } + if (property0.NameEquals("databaseAccountOfferType")) + { + databaseAccountOfferType = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("ipRules")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(IpAddressOrRange.DeserializeIpAddressOrRange(item)); + } + ipRules = array; + continue; + } + if (property0.NameEquals("isVirtualNetworkFilterEnabled")) + { + isVirtualNetworkFilterEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("enableAutomaticFailover")) + { + enableAutomaticFailover = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("capabilities")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Capability.DeserializeCapability(item)); + } + capabilities = array; + continue; + } + if (property0.NameEquals("virtualNetworkRules")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(VirtualNetworkRule.DeserializeVirtualNetworkRule(item)); + } + virtualNetworkRules = array; + continue; + } + if (property0.NameEquals("enableMultipleWriteLocations")) + { + enableMultipleWriteLocations = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("enableCassandraConnector")) + { + enableCassandraConnector = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("connectorOffer")) + { + connectorOffer = new ConnectorOffer(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("disableKeyBasedMetadataWriteAccess")) + { + disableKeyBasedMetadataWriteAccess = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("keyVaultKeyUri")) + { + keyVaultKeyUri = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("publicNetworkAccess")) + { + publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("enableFreeTier")) + { + enableFreeTier = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("apiProperties")) + { + apiProperties = ApiProperties.DeserializeApiProperties(property0.Value); + continue; + } + if (property0.NameEquals("enableAnalyticalStorage")) + { + enableAnalyticalStorage = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("cors")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(CorsPolicy.DeserializeCorsPolicy(item)); + } + cors = array; + continue; + } + } + continue; + } + } + return new DatabaseAccountCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToNullable(kind), consistencyPolicy.Value, locations, databaseAccountOfferType, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), Optional.ToList(capabilities), Optional.ToList(virtualNetworkRules), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), Optional.ToList(cors)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.cs new file mode 100644 index 000000000000..f1a1cdf2cb39 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB database accounts. + public partial class DatabaseAccountCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of DatabaseAccountCreateUpdateParameters. + /// An array that contains the georeplication locations enabled for the Cosmos DB account. + /// is null. + public DatabaseAccountCreateUpdateParameters(IEnumerable locations) + { + if (locations == null) + { + throw new ArgumentNullException(nameof(locations)); + } + + Locations = locations.ToList(); + DatabaseAccountOfferType = "Standard"; + IpRules = new ChangeTrackingList(); + Capabilities = new ChangeTrackingList(); + VirtualNetworkRules = new ChangeTrackingList(); + Cors = new ChangeTrackingList(); + } + + /// Initializes a new instance of DatabaseAccountCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Indicates the type of database account. This can only be set at database account creation. + /// The consistency policy for the Cosmos DB account. + /// An array that contains the georeplication locations enabled for the Cosmos DB account. + /// The offer type for the database. + /// List of IpRules. + /// Flag to indicate whether to enable/disable Virtual Network ACL rules. + /// Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + /// List of Cosmos DB capabilities for the account. + /// List of Virtual Network ACL rules configured for the Cosmos DB account. + /// Enables the account to write in multiple locations. + /// Enables the cassandra connector on the Cosmos DB C* account. + /// The cassandra connector offer type for the Cosmos DB database C* account. + /// Disable write operations on metadata resources (databases, containers, throughput) via account keys. + /// The URI of the key vault. + /// Whether requests from Public Network are allowed. + /// Flag to indicate whether Free Tier is enabled. + /// API specific properties. Currently, supported only for MongoDB API. + /// Flag to indicate whether to enable storage analytics. + /// The CORS policy for the Cosmos DB database account. + internal DatabaseAccountCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, DatabaseAccountKind? kind, ConsistencyPolicy consistencyPolicy, IList locations, string databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, IList capabilities, IList virtualNetworkRules, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, string keyVaultKeyUri, PublicNetworkAccess? publicNetworkAccess, bool? enableFreeTier, ApiProperties apiProperties, bool? enableAnalyticalStorage, IList cors) : base(id, name, type, location, tags) + { + Kind = kind; + ConsistencyPolicy = consistencyPolicy; + Locations = locations; + DatabaseAccountOfferType = databaseAccountOfferType; + IpRules = ipRules; + IsVirtualNetworkFilterEnabled = isVirtualNetworkFilterEnabled; + EnableAutomaticFailover = enableAutomaticFailover; + Capabilities = capabilities; + VirtualNetworkRules = virtualNetworkRules; + EnableMultipleWriteLocations = enableMultipleWriteLocations; + EnableCassandraConnector = enableCassandraConnector; + ConnectorOffer = connectorOffer; + DisableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess; + KeyVaultKeyUri = keyVaultKeyUri; + PublicNetworkAccess = publicNetworkAccess; + EnableFreeTier = enableFreeTier; + ApiProperties = apiProperties; + EnableAnalyticalStorage = enableAnalyticalStorage; + Cors = cors; + } + + /// Indicates the type of database account. This can only be set at database account creation. + public DatabaseAccountKind? Kind { get; set; } + /// The consistency policy for the Cosmos DB account. + public ConsistencyPolicy ConsistencyPolicy { get; set; } + /// An array that contains the georeplication locations enabled for the Cosmos DB account. + public IList Locations { get; } + /// The offer type for the database. + public string DatabaseAccountOfferType { get; set; } + /// List of IpRules. + public IList IpRules { get; } + /// Flag to indicate whether to enable/disable Virtual Network ACL rules. + public bool? IsVirtualNetworkFilterEnabled { get; set; } + /// Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + public bool? EnableAutomaticFailover { get; set; } + /// List of Cosmos DB capabilities for the account. + public IList Capabilities { get; } + /// List of Virtual Network ACL rules configured for the Cosmos DB account. + public IList VirtualNetworkRules { get; } + /// Enables the account to write in multiple locations. + public bool? EnableMultipleWriteLocations { get; set; } + /// Enables the cassandra connector on the Cosmos DB C* account. + public bool? EnableCassandraConnector { get; set; } + /// The cassandra connector offer type for the Cosmos DB database C* account. + public ConnectorOffer? ConnectorOffer { get; set; } + /// Disable write operations on metadata resources (databases, containers, throughput) via account keys. + public bool? DisableKeyBasedMetadataWriteAccess { get; set; } + /// The URI of the key vault. + public string KeyVaultKeyUri { get; set; } + /// Whether requests from Public Network are allowed. + public PublicNetworkAccess? PublicNetworkAccess { get; } + /// Flag to indicate whether Free Tier is enabled. + public bool? EnableFreeTier { get; set; } + /// API specific properties. Currently, supported only for MongoDB API. + public ApiProperties ApiProperties { get; set; } + /// Flag to indicate whether to enable storage analytics. + public bool? EnableAnalyticalStorage { get; set; } + /// The CORS policy for the Cosmos DB database account. + public IList Cors { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.Serialization.cs new file mode 100644 index 000000000000..b3aef9b151f6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.Serialization.cs @@ -0,0 +1,386 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DatabaseAccountGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind.Value.ToString()); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsCollectionDefined(IpRules)) + { + writer.WritePropertyName("ipRules"); + writer.WriteStartArray(); + foreach (var item in IpRules) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(IsVirtualNetworkFilterEnabled)) + { + writer.WritePropertyName("isVirtualNetworkFilterEnabled"); + writer.WriteBooleanValue(IsVirtualNetworkFilterEnabled.Value); + } + if (Optional.IsDefined(EnableAutomaticFailover)) + { + writer.WritePropertyName("enableAutomaticFailover"); + writer.WriteBooleanValue(EnableAutomaticFailover.Value); + } + if (Optional.IsDefined(ConsistencyPolicy)) + { + writer.WritePropertyName("consistencyPolicy"); + writer.WriteObjectValue(ConsistencyPolicy); + } + if (Optional.IsCollectionDefined(Capabilities)) + { + writer.WritePropertyName("capabilities"); + writer.WriteStartArray(); + foreach (var item in Capabilities) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(VirtualNetworkRules)) + { + writer.WritePropertyName("virtualNetworkRules"); + writer.WriteStartArray(); + foreach (var item in VirtualNetworkRules) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(EnableMultipleWriteLocations)) + { + writer.WritePropertyName("enableMultipleWriteLocations"); + writer.WriteBooleanValue(EnableMultipleWriteLocations.Value); + } + if (Optional.IsDefined(EnableCassandraConnector)) + { + writer.WritePropertyName("enableCassandraConnector"); + writer.WriteBooleanValue(EnableCassandraConnector.Value); + } + if (Optional.IsDefined(ConnectorOffer)) + { + writer.WritePropertyName("connectorOffer"); + writer.WriteStringValue(ConnectorOffer.Value.ToString()); + } + if (Optional.IsDefined(DisableKeyBasedMetadataWriteAccess)) + { + writer.WritePropertyName("disableKeyBasedMetadataWriteAccess"); + writer.WriteBooleanValue(DisableKeyBasedMetadataWriteAccess.Value); + } + if (Optional.IsDefined(KeyVaultKeyUri)) + { + writer.WritePropertyName("keyVaultKeyUri"); + writer.WriteStringValue(KeyVaultKeyUri); + } + if (Optional.IsDefined(EnableFreeTier)) + { + writer.WritePropertyName("enableFreeTier"); + writer.WriteBooleanValue(EnableFreeTier.Value); + } + if (Optional.IsDefined(ApiProperties)) + { + writer.WritePropertyName("apiProperties"); + writer.WriteObjectValue(ApiProperties); + } + if (Optional.IsDefined(EnableAnalyticalStorage)) + { + writer.WritePropertyName("enableAnalyticalStorage"); + writer.WriteBooleanValue(EnableAnalyticalStorage.Value); + } + if (Optional.IsCollectionDefined(Cors)) + { + writer.WritePropertyName("cors"); + writer.WriteStartArray(); + foreach (var item in Cors) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DatabaseAccountGetResults DeserializeDatabaseAccountGetResults(JsonElement element) + { + Optional kind = default; + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional provisioningState = default; + Optional documentEndpoint = default; + Optional databaseAccountOfferType = default; + Optional> ipRules = default; + Optional isVirtualNetworkFilterEnabled = default; + Optional enableAutomaticFailover = default; + Optional consistencyPolicy = default; + Optional> capabilities = default; + Optional> writeLocations = default; + Optional> readLocations = default; + Optional> locations = default; + Optional> failoverPolicies = default; + Optional> virtualNetworkRules = default; + Optional> privateEndpointConnections = default; + Optional enableMultipleWriteLocations = default; + Optional enableCassandraConnector = default; + Optional connectorOffer = default; + Optional disableKeyBasedMetadataWriteAccess = default; + Optional keyVaultKeyUri = default; + Optional publicNetworkAccess = default; + Optional enableFreeTier = default; + Optional apiProperties = default; + Optional enableAnalyticalStorage = default; + Optional> cors = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind")) + { + kind = new DatabaseAccountKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState")) + { + provisioningState = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("documentEndpoint")) + { + documentEndpoint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("databaseAccountOfferType")) + { + databaseAccountOfferType = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("ipRules")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(IpAddressOrRange.DeserializeIpAddressOrRange(item)); + } + ipRules = array; + continue; + } + if (property0.NameEquals("isVirtualNetworkFilterEnabled")) + { + isVirtualNetworkFilterEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("enableAutomaticFailover")) + { + enableAutomaticFailover = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("consistencyPolicy")) + { + consistencyPolicy = ConsistencyPolicy.DeserializeConsistencyPolicy(property0.Value); + continue; + } + if (property0.NameEquals("capabilities")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Capability.DeserializeCapability(item)); + } + capabilities = array; + continue; + } + if (property0.NameEquals("writeLocations")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Models.Location.DeserializeLocation(item)); + } + writeLocations = array; + continue; + } + if (property0.NameEquals("readLocations")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Models.Location.DeserializeLocation(item)); + } + readLocations = array; + continue; + } + if (property0.NameEquals("locations")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Models.Location.DeserializeLocation(item)); + } + locations = array; + continue; + } + if (property0.NameEquals("failoverPolicies")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(FailoverPolicy.DeserializeFailoverPolicy(item)); + } + failoverPolicies = array; + continue; + } + if (property0.NameEquals("virtualNetworkRules")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(VirtualNetworkRule.DeserializeVirtualNetworkRule(item)); + } + virtualNetworkRules = array; + continue; + } + if (property0.NameEquals("privateEndpointConnections")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(PrivateEndpointConnection.DeserializePrivateEndpointConnection(item)); + } + privateEndpointConnections = array; + continue; + } + if (property0.NameEquals("enableMultipleWriteLocations")) + { + enableMultipleWriteLocations = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("enableCassandraConnector")) + { + enableCassandraConnector = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("connectorOffer")) + { + connectorOffer = new ConnectorOffer(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("disableKeyBasedMetadataWriteAccess")) + { + disableKeyBasedMetadataWriteAccess = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("keyVaultKeyUri")) + { + keyVaultKeyUri = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("publicNetworkAccess")) + { + publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("enableFreeTier")) + { + enableFreeTier = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("apiProperties")) + { + apiProperties = ApiProperties.DeserializeApiProperties(property0.Value); + continue; + } + if (property0.NameEquals("enableAnalyticalStorage")) + { + enableAnalyticalStorage = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("cors")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(CorsPolicy.DeserializeCorsPolicy(item)); + } + cors = array; + continue; + } + } + continue; + } + } + return new DatabaseAccountGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToNullable(kind), provisioningState.Value, documentEndpoint.Value, databaseAccountOfferType.Value, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), consistencyPolicy.Value, Optional.ToList(capabilities), Optional.ToList(writeLocations), Optional.ToList(readLocations), Optional.ToList(locations), Optional.ToList(failoverPolicies), Optional.ToList(virtualNetworkRules), Optional.ToList(privateEndpointConnections), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), Optional.ToList(cors)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.cs new file mode 100644 index 000000000000..a0db189203ed --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB database account. + public partial class DatabaseAccountGetResults : ARMResourceProperties + { + /// Initializes a new instance of DatabaseAccountGetResults. + public DatabaseAccountGetResults() + { + DatabaseAccountOfferType = "Standard"; + IpRules = new ChangeTrackingList(); + Capabilities = new ChangeTrackingList(); + WriteLocations = new ChangeTrackingList(); + ReadLocations = new ChangeTrackingList(); + Locations = new ChangeTrackingList(); + FailoverPolicies = new ChangeTrackingList(); + VirtualNetworkRules = new ChangeTrackingList(); + PrivateEndpointConnections = new ChangeTrackingList(); + Cors = new ChangeTrackingList(); + } + + /// Initializes a new instance of DatabaseAccountGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Indicates the type of database account. This can only be set at database account creation. + /// The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB account deletion failed. + /// The connection endpoint for the Cosmos DB database account. + /// The offer type for the Cosmos DB database account. Default value: Standard. + /// List of IpRules. + /// Flag to indicate whether to enable/disable Virtual Network ACL rules. + /// Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + /// The consistency policy for the Cosmos DB database account. + /// List of Cosmos DB capabilities for the account. + /// An array that contains the write location for the Cosmos DB account. + /// An array that contains of the read locations enabled for the Cosmos DB account. + /// An array that contains all of the locations enabled for the Cosmos DB account. + /// An array that contains the regions ordered by their failover priorities. + /// List of Virtual Network ACL rules configured for the Cosmos DB account. + /// List of Private Endpoint Connections configured for the Cosmos DB account. + /// Enables the account to write in multiple locations. + /// Enables the cassandra connector on the Cosmos DB C* account. + /// The cassandra connector offer type for the Cosmos DB database C* account. + /// Disable write operations on metadata resources (databases, containers, throughput) via account keys. + /// The URI of the key vault. + /// Whether requests from Public Network are allowed. + /// Flag to indicate whether Free Tier is enabled. + /// API specific properties. + /// Flag to indicate whether to enable storage analytics. + /// The CORS policy for the Cosmos DB database account. + internal DatabaseAccountGetResults(string id, string name, string type, string location, IDictionary tags, DatabaseAccountKind? kind, string provisioningState, string documentEndpoint, string databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, ConsistencyPolicy consistencyPolicy, IList capabilities, IReadOnlyList writeLocations, IReadOnlyList readLocations, IReadOnlyList locations, IReadOnlyList failoverPolicies, IList virtualNetworkRules, IReadOnlyList privateEndpointConnections, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, string keyVaultKeyUri, PublicNetworkAccess? publicNetworkAccess, bool? enableFreeTier, ApiProperties apiProperties, bool? enableAnalyticalStorage, IList cors) : base(id, name, type, location, tags) + { + Kind = kind; + ProvisioningState = provisioningState; + DocumentEndpoint = documentEndpoint; + DatabaseAccountOfferType = databaseAccountOfferType; + IpRules = ipRules; + IsVirtualNetworkFilterEnabled = isVirtualNetworkFilterEnabled; + EnableAutomaticFailover = enableAutomaticFailover; + ConsistencyPolicy = consistencyPolicy; + Capabilities = capabilities; + WriteLocations = writeLocations; + ReadLocations = readLocations; + Locations = locations; + FailoverPolicies = failoverPolicies; + VirtualNetworkRules = virtualNetworkRules; + PrivateEndpointConnections = privateEndpointConnections; + EnableMultipleWriteLocations = enableMultipleWriteLocations; + EnableCassandraConnector = enableCassandraConnector; + ConnectorOffer = connectorOffer; + DisableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess; + KeyVaultKeyUri = keyVaultKeyUri; + PublicNetworkAccess = publicNetworkAccess; + EnableFreeTier = enableFreeTier; + ApiProperties = apiProperties; + EnableAnalyticalStorage = enableAnalyticalStorage; + Cors = cors; + } + + /// Indicates the type of database account. This can only be set at database account creation. + public DatabaseAccountKind? Kind { get; set; } + /// The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB account deletion failed. + public string ProvisioningState { get; } + /// The connection endpoint for the Cosmos DB database account. + public string DocumentEndpoint { get; } + /// The offer type for the Cosmos DB database account. Default value: Standard. + public string DatabaseAccountOfferType { get; } + /// List of IpRules. + public IList IpRules { get; } + /// Flag to indicate whether to enable/disable Virtual Network ACL rules. + public bool? IsVirtualNetworkFilterEnabled { get; set; } + /// Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + public bool? EnableAutomaticFailover { get; set; } + /// The consistency policy for the Cosmos DB database account. + public ConsistencyPolicy ConsistencyPolicy { get; set; } + /// List of Cosmos DB capabilities for the account. + public IList Capabilities { get; } + /// An array that contains the write location for the Cosmos DB account. + public IReadOnlyList WriteLocations { get; } + /// An array that contains of the read locations enabled for the Cosmos DB account. + public IReadOnlyList ReadLocations { get; } + /// An array that contains all of the locations enabled for the Cosmos DB account. + public IReadOnlyList Locations { get; } + /// An array that contains the regions ordered by their failover priorities. + public IReadOnlyList FailoverPolicies { get; } + /// List of Virtual Network ACL rules configured for the Cosmos DB account. + public IList VirtualNetworkRules { get; } + /// List of Private Endpoint Connections configured for the Cosmos DB account. + public IReadOnlyList PrivateEndpointConnections { get; } + /// Enables the account to write in multiple locations. + public bool? EnableMultipleWriteLocations { get; set; } + /// Enables the cassandra connector on the Cosmos DB C* account. + public bool? EnableCassandraConnector { get; set; } + /// The cassandra connector offer type for the Cosmos DB database C* account. + public ConnectorOffer? ConnectorOffer { get; set; } + /// Disable write operations on metadata resources (databases, containers, throughput) via account keys. + public bool? DisableKeyBasedMetadataWriteAccess { get; set; } + /// The URI of the key vault. + public string KeyVaultKeyUri { get; set; } + /// Whether requests from Public Network are allowed. + public PublicNetworkAccess? PublicNetworkAccess { get; } + /// Flag to indicate whether Free Tier is enabled. + public bool? EnableFreeTier { get; set; } + /// API specific properties. + public ApiProperties ApiProperties { get; set; } + /// Flag to indicate whether to enable storage analytics. + public bool? EnableAnalyticalStorage { get; set; } + /// The CORS policy for the Cosmos DB database account. + public IList Cors { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountKind.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountKind.cs new file mode 100644 index 000000000000..c8ebe03830a4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountKind.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Indicates the type of database account. This can only be set at database account creation. + public readonly partial struct DatabaseAccountKind : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public DatabaseAccountKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string GlobalDocumentDBValue = "GlobalDocumentDB"; + private const string MongoDBValue = "MongoDB"; + private const string ParseValue = "Parse"; + + /// GlobalDocumentDB. + public static DatabaseAccountKind GlobalDocumentDB { get; } = new DatabaseAccountKind(GlobalDocumentDBValue); + /// MongoDB. + public static DatabaseAccountKind MongoDB { get; } = new DatabaseAccountKind(MongoDBValue); + /// Parse. + public static DatabaseAccountKind Parse { get; } = new DatabaseAccountKind(ParseValue); + /// Determines if two values are the same. + public static bool operator ==(DatabaseAccountKind left, DatabaseAccountKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DatabaseAccountKind left, DatabaseAccountKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DatabaseAccountKind(string value) => new DatabaseAccountKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DatabaseAccountKind other && Equals(other); + /// + public bool Equals(DatabaseAccountKind 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.Serialization.cs new file mode 100644 index 000000000000..4e3b250d5c00 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DatabaseAccountListConnectionStringsResult + { + internal static DatabaseAccountListConnectionStringsResult DeserializeDatabaseAccountListConnectionStringsResult(JsonElement element) + { + Optional> connectionStrings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("connectionStrings")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseAccountConnectionString.DeserializeDatabaseAccountConnectionString(item)); + } + connectionStrings = array; + continue; + } + } + return new DatabaseAccountListConnectionStringsResult(Optional.ToList(connectionStrings)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.cs new file mode 100644 index 000000000000..2406dbf7db25 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The connection strings for the given database account. + public partial class DatabaseAccountListConnectionStringsResult + { + /// Initializes a new instance of DatabaseAccountListConnectionStringsResult. + internal DatabaseAccountListConnectionStringsResult() + { + ConnectionStrings = new ChangeTrackingList(); + } + + /// Initializes a new instance of DatabaseAccountListConnectionStringsResult. + /// An array that contains the connection strings for the Cosmos DB account. + internal DatabaseAccountListConnectionStringsResult(IReadOnlyList connectionStrings) + { + ConnectionStrings = connectionStrings; + } + + /// An array that contains the connection strings for the Cosmos DB account. + public IReadOnlyList ConnectionStrings { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListKeysResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListKeysResult.Serialization.cs new file mode 100644 index 000000000000..ae57aaf063d1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListKeysResult.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DatabaseAccountListKeysResult + { + internal static DatabaseAccountListKeysResult DeserializeDatabaseAccountListKeysResult(JsonElement element) + { + Optional primaryMasterKey = default; + Optional secondaryMasterKey = default; + Optional primaryReadonlyMasterKey = default; + Optional secondaryReadonlyMasterKey = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("primaryMasterKey")) + { + primaryMasterKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("secondaryMasterKey")) + { + secondaryMasterKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("primaryReadonlyMasterKey")) + { + primaryReadonlyMasterKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("secondaryReadonlyMasterKey")) + { + secondaryReadonlyMasterKey = property.Value.GetString(); + continue; + } + } + return new DatabaseAccountListKeysResult(primaryReadonlyMasterKey.Value, secondaryReadonlyMasterKey.Value, primaryMasterKey.Value, secondaryMasterKey.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListKeysResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListKeysResult.cs new file mode 100644 index 000000000000..8252b2817e10 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListKeysResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The access keys for the given database account. + public partial class DatabaseAccountListKeysResult : DatabaseAccountListReadOnlyKeysResult + { + /// Initializes a new instance of DatabaseAccountListKeysResult. + internal DatabaseAccountListKeysResult() + { + } + + /// Initializes a new instance of DatabaseAccountListKeysResult. + /// Base 64 encoded value of the primary read-only key. + /// Base 64 encoded value of the secondary read-only key. + /// Base 64 encoded value of the primary read-write key. + /// Base 64 encoded value of the secondary read-write key. + internal DatabaseAccountListKeysResult(string primaryReadonlyMasterKey, string secondaryReadonlyMasterKey, string primaryMasterKey, string secondaryMasterKey) : base(primaryReadonlyMasterKey, secondaryReadonlyMasterKey) + { + PrimaryMasterKey = primaryMasterKey; + SecondaryMasterKey = secondaryMasterKey; + } + + /// Base 64 encoded value of the primary read-write key. + public string PrimaryMasterKey { get; } + /// Base 64 encoded value of the secondary read-write key. + public string SecondaryMasterKey { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListReadOnlyKeysResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListReadOnlyKeysResult.Serialization.cs new file mode 100644 index 000000000000..7507ecbc7dc4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListReadOnlyKeysResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DatabaseAccountListReadOnlyKeysResult + { + internal static DatabaseAccountListReadOnlyKeysResult DeserializeDatabaseAccountListReadOnlyKeysResult(JsonElement element) + { + Optional primaryReadonlyMasterKey = default; + Optional secondaryReadonlyMasterKey = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("primaryReadonlyMasterKey")) + { + primaryReadonlyMasterKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("secondaryReadonlyMasterKey")) + { + secondaryReadonlyMasterKey = property.Value.GetString(); + continue; + } + } + return new DatabaseAccountListReadOnlyKeysResult(primaryReadonlyMasterKey.Value, secondaryReadonlyMasterKey.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListReadOnlyKeysResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListReadOnlyKeysResult.cs new file mode 100644 index 000000000000..c111baf0aaec --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListReadOnlyKeysResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The read-only access keys for the given database account. + public partial class DatabaseAccountListReadOnlyKeysResult + { + /// Initializes a new instance of DatabaseAccountListReadOnlyKeysResult. + internal DatabaseAccountListReadOnlyKeysResult() + { + } + + /// Initializes a new instance of DatabaseAccountListReadOnlyKeysResult. + /// Base 64 encoded value of the primary read-only key. + /// Base 64 encoded value of the secondary read-only key. + internal DatabaseAccountListReadOnlyKeysResult(string primaryReadonlyMasterKey, string secondaryReadonlyMasterKey) + { + PrimaryReadonlyMasterKey = primaryReadonlyMasterKey; + SecondaryReadonlyMasterKey = secondaryReadonlyMasterKey; + } + + /// Base 64 encoded value of the primary read-only key. + public string PrimaryReadonlyMasterKey { get; } + /// Base 64 encoded value of the secondary read-only key. + public string SecondaryReadonlyMasterKey { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountRegenerateKeyParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountRegenerateKeyParameters.Serialization.cs new file mode 100644 index 000000000000..d066f8e31e28 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountRegenerateKeyParameters.Serialization.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DatabaseAccountRegenerateKeyParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("keyKind"); + writer.WriteStringValue(KeyKind.ToString()); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountRegenerateKeyParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountRegenerateKeyParameters.cs new file mode 100644 index 000000000000..46fad1faff8b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountRegenerateKeyParameters.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to regenerate the keys within the database account. + public partial class DatabaseAccountRegenerateKeyParameters + { + /// Initializes a new instance of DatabaseAccountRegenerateKeyParameters. + /// The access key to regenerate. + public DatabaseAccountRegenerateKeyParameters(KeyKind keyKind) + { + KeyKind = keyKind; + } + + /// The access key to regenerate. + public KeyKind KeyKind { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..a5d8cee46b21 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DatabaseAccountUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(ConsistencyPolicy)) + { + writer.WritePropertyName("consistencyPolicy"); + writer.WriteObjectValue(ConsistencyPolicy); + } + if (Optional.IsCollectionDefined(Locations)) + { + writer.WritePropertyName("locations"); + writer.WriteStartArray(); + foreach (var item in Locations) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IpRules)) + { + writer.WritePropertyName("ipRules"); + writer.WriteStartArray(); + foreach (var item in IpRules) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(IsVirtualNetworkFilterEnabled)) + { + writer.WritePropertyName("isVirtualNetworkFilterEnabled"); + writer.WriteBooleanValue(IsVirtualNetworkFilterEnabled.Value); + } + if (Optional.IsDefined(EnableAutomaticFailover)) + { + writer.WritePropertyName("enableAutomaticFailover"); + writer.WriteBooleanValue(EnableAutomaticFailover.Value); + } + if (Optional.IsCollectionDefined(Capabilities)) + { + writer.WritePropertyName("capabilities"); + writer.WriteStartArray(); + foreach (var item in Capabilities) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(VirtualNetworkRules)) + { + writer.WritePropertyName("virtualNetworkRules"); + writer.WriteStartArray(); + foreach (var item in VirtualNetworkRules) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(EnableMultipleWriteLocations)) + { + writer.WritePropertyName("enableMultipleWriteLocations"); + writer.WriteBooleanValue(EnableMultipleWriteLocations.Value); + } + if (Optional.IsDefined(EnableCassandraConnector)) + { + writer.WritePropertyName("enableCassandraConnector"); + writer.WriteBooleanValue(EnableCassandraConnector.Value); + } + if (Optional.IsDefined(ConnectorOffer)) + { + writer.WritePropertyName("connectorOffer"); + writer.WriteStringValue(ConnectorOffer.Value.ToString()); + } + if (Optional.IsDefined(DisableKeyBasedMetadataWriteAccess)) + { + writer.WritePropertyName("disableKeyBasedMetadataWriteAccess"); + writer.WriteBooleanValue(DisableKeyBasedMetadataWriteAccess.Value); + } + if (Optional.IsDefined(KeyVaultKeyUri)) + { + writer.WritePropertyName("keyVaultKeyUri"); + writer.WriteStringValue(KeyVaultKeyUri); + } + if (Optional.IsDefined(EnableFreeTier)) + { + writer.WritePropertyName("enableFreeTier"); + writer.WriteBooleanValue(EnableFreeTier.Value); + } + if (Optional.IsDefined(ApiProperties)) + { + writer.WritePropertyName("apiProperties"); + writer.WriteObjectValue(ApiProperties); + } + if (Optional.IsDefined(EnableAnalyticalStorage)) + { + writer.WritePropertyName("enableAnalyticalStorage"); + writer.WriteBooleanValue(EnableAnalyticalStorage.Value); + } + if (Optional.IsCollectionDefined(Cors)) + { + writer.WritePropertyName("cors"); + writer.WriteStartArray(); + foreach (var item in Cors) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.cs new file mode 100644 index 000000000000..5d24ee0823c3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters for patching Azure Cosmos DB database account properties. + public partial class DatabaseAccountUpdateParameters + { + /// Initializes a new instance of DatabaseAccountUpdateParameters. + public DatabaseAccountUpdateParameters() + { + Tags = new ChangeTrackingDictionary(); + Locations = new ChangeTrackingList(); + IpRules = new ChangeTrackingList(); + Capabilities = new ChangeTrackingList(); + VirtualNetworkRules = new ChangeTrackingList(); + Cors = new ChangeTrackingList(); + } + + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + public IDictionary Tags { get; } + /// The location of the resource group to which the resource belongs. + public string Location { get; set; } + /// The consistency policy for the Cosmos DB account. + public ConsistencyPolicy ConsistencyPolicy { get; set; } + /// An array that contains the georeplication locations enabled for the Cosmos DB account. + public IList Locations { get; } + /// List of IpRules. + public IList IpRules { get; } + /// Flag to indicate whether to enable/disable Virtual Network ACL rules. + public bool? IsVirtualNetworkFilterEnabled { get; set; } + /// Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + public bool? EnableAutomaticFailover { get; set; } + /// List of Cosmos DB capabilities for the account. + public IList Capabilities { get; } + /// List of Virtual Network ACL rules configured for the Cosmos DB account. + public IList VirtualNetworkRules { get; } + /// Enables the account to write in multiple locations. + public bool? EnableMultipleWriteLocations { get; set; } + /// Enables the cassandra connector on the Cosmos DB C* account. + public bool? EnableCassandraConnector { get; set; } + /// The cassandra connector offer type for the Cosmos DB database C* account. + public ConnectorOffer? ConnectorOffer { get; set; } + /// Disable write operations on metadata resources (databases, containers, throughput) via account keys. + public bool? DisableKeyBasedMetadataWriteAccess { get; set; } + /// The URI of the key vault. + public string KeyVaultKeyUri { get; set; } + /// Whether requests from Public Network are allowed. + public PublicNetworkAccess? PublicNetworkAccess { get; } + /// Flag to indicate whether Free Tier is enabled. + public bool? EnableFreeTier { get; set; } + /// API specific properties. Currently, supported only for MongoDB API. + public ApiProperties ApiProperties { get; set; } + /// Flag to indicate whether to enable storage analytics. + public bool? EnableAnalyticalStorage { get; set; } + /// The CORS policy for the Cosmos DB database account. + public IList Cors { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.Serialization.cs new file mode 100644 index 000000000000..82f1794a2505 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DatabaseAccountsListResult + { + internal static DatabaseAccountsListResult DeserializeDatabaseAccountsListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseAccountGetResults.DeserializeDatabaseAccountGetResults(item)); + } + value = array; + continue; + } + } + return new DatabaseAccountsListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.cs new file mode 100644 index 000000000000..33866e22f4a9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the database accounts and their properties. + public partial class DatabaseAccountsListResult + { + /// Initializes a new instance of DatabaseAccountsListResult. + internal DatabaseAccountsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DatabaseAccountsListResult. + /// List of database account and their properties. + internal DatabaseAccountsListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of database account and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultConsistencyLevel.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultConsistencyLevel.Serialization.cs new file mode 100644 index 000000000000..93a14c10f8f2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultConsistencyLevel.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal static class DefaultConsistencyLevelExtensions + { + public static string ToSerialString(this DefaultConsistencyLevel value) => value switch + { + DefaultConsistencyLevel.Eventual => "Eventual", + DefaultConsistencyLevel.Session => "Session", + DefaultConsistencyLevel.BoundedStaleness => "BoundedStaleness", + DefaultConsistencyLevel.Strong => "Strong", + DefaultConsistencyLevel.ConsistentPrefix => "ConsistentPrefix", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DefaultConsistencyLevel value.") + }; + + public static DefaultConsistencyLevel ToDefaultConsistencyLevel(this string value) + { + if (string.Equals(value, "Eventual", StringComparison.InvariantCultureIgnoreCase)) return DefaultConsistencyLevel.Eventual; + if (string.Equals(value, "Session", StringComparison.InvariantCultureIgnoreCase)) return DefaultConsistencyLevel.Session; + if (string.Equals(value, "BoundedStaleness", StringComparison.InvariantCultureIgnoreCase)) return DefaultConsistencyLevel.BoundedStaleness; + if (string.Equals(value, "Strong", StringComparison.InvariantCultureIgnoreCase)) return DefaultConsistencyLevel.Strong; + if (string.Equals(value, "ConsistentPrefix", StringComparison.InvariantCultureIgnoreCase)) return DefaultConsistencyLevel.ConsistentPrefix; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DefaultConsistencyLevel value."); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultConsistencyLevel.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultConsistencyLevel.cs new file mode 100644 index 000000000000..5cbf5972468f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultConsistencyLevel.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The default consistency level and configuration settings of the Cosmos DB account. + public enum DefaultConsistencyLevel + { + /// Eventual. + Eventual, + /// Session. + Session, + /// BoundedStaleness. + BoundedStaleness, + /// Strong. + Strong, + /// ConsistentPrefix. + ConsistentPrefix + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.Serialization.cs new file mode 100644 index 000000000000..84964bd7831f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class ErrorResponse + { + internal static ErrorResponse DeserializeErrorResponse(JsonElement element) + { + Optional code = default; + Optional message = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code")) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("message")) + { + message = property.Value.GetString(); + continue; + } + } + return new ErrorResponse(code.Value, message.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..cfa31b9e0539 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Error Response. + internal partial class ErrorResponse + { + /// Initializes a new instance of ErrorResponse. + internal ErrorResponse() + { + } + + /// Initializes a new instance of ErrorResponse. + /// Error code. + /// Error message indicating why the operation failed. + internal ErrorResponse(string code, string message) + { + Code = code; + Message = message; + } + + /// Error code. + public string Code { get; } + /// Error message indicating why the operation failed. + public string Message { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExcludedPath.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExcludedPath.Serialization.cs new file mode 100644 index 000000000000..43ecafc4bd43 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExcludedPath.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ExcludedPath : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"); + writer.WriteStringValue(Path); + } + writer.WriteEndObject(); + } + + internal static ExcludedPath DeserializeExcludedPath(JsonElement element) + { + Optional path = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("path")) + { + path = property.Value.GetString(); + continue; + } + } + return new ExcludedPath(path.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExcludedPath.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExcludedPath.cs new file mode 100644 index 000000000000..91452964f6ee --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExcludedPath.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The ExcludedPath. + public partial class ExcludedPath + { + /// Initializes a new instance of ExcludedPath. + public ExcludedPath() + { + } + + /// Initializes a new instance of ExcludedPath. + /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + internal ExcludedPath(string path) + { + Path = path; + } + + /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + public string Path { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.Serialization.cs new file mode 100644 index 000000000000..9d1b52189426 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ExtendedResourceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static ExtendedResourceProperties DeserializeExtendedResourceProperties(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + } + return new ExtendedResourceProperties(Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.cs new file mode 100644 index 000000000000..4eff6559532b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The system generated resource properties associated with SQL databases, SQL containers, Gremlin databases and Gremlin graphs. + public partial class ExtendedResourceProperties + { + /// Initializes a new instance of ExtendedResourceProperties. + public ExtendedResourceProperties() + { + } + + /// Initializes a new instance of ExtendedResourceProperties. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + internal ExtendedResourceProperties(string rid, object ts, string etag) + { + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FailoverPolicies.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FailoverPolicies.Serialization.cs new file mode 100644 index 000000000000..ea7f5ee591a3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FailoverPolicies.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.ResourceManager.CosmosDB.Models +{ + public partial class FailoverPolicies : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("failoverPolicies"); + writer.WriteStartArray(); + foreach (var item in FailoverPoliciesValue) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FailoverPolicies.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FailoverPolicies.cs new file mode 100644 index 000000000000..dee924857641 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FailoverPolicies.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The list of new failover policies for the failover priority change. + public partial class FailoverPolicies + { + /// Initializes a new instance of FailoverPolicies. + /// List of failover policies. + /// is null. + public FailoverPolicies(IEnumerable failoverPoliciesValue) + { + if (failoverPoliciesValue == null) + { + throw new ArgumentNullException(nameof(failoverPoliciesValue)); + } + + FailoverPoliciesValue = failoverPoliciesValue.ToList(); + } + + /// List of failover policies. + public IList FailoverPoliciesValue { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FailoverPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FailoverPolicy.Serialization.cs new file mode 100644 index 000000000000..d6173a2fa0b3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FailoverPolicy.Serialization.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class FailoverPolicy : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(LocationName)) + { + writer.WritePropertyName("locationName"); + writer.WriteStringValue(LocationName); + } + if (Optional.IsDefined(FailoverPriority)) + { + writer.WritePropertyName("failoverPriority"); + writer.WriteNumberValue(FailoverPriority.Value); + } + writer.WriteEndObject(); + } + + internal static FailoverPolicy DeserializeFailoverPolicy(JsonElement element) + { + Optional id = default; + Optional locationName = default; + Optional failoverPriority = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("locationName")) + { + locationName = property.Value.GetString(); + continue; + } + if (property.NameEquals("failoverPriority")) + { + failoverPriority = property.Value.GetInt32(); + continue; + } + } + return new FailoverPolicy(id.Value, locationName.Value, Optional.ToNullable(failoverPriority)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FailoverPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FailoverPolicy.cs new file mode 100644 index 000000000000..4f48078889d4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FailoverPolicy.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The failover policy for a given region of a database account. + public partial class FailoverPolicy + { + /// Initializes a new instance of FailoverPolicy. + public FailoverPolicy() + { + } + + /// Initializes a new instance of FailoverPolicy. + /// The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. + /// The name of the region in which the database account exists. + /// The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + internal FailoverPolicy(string id, string locationName, int? failoverPriority) + { + Id = id; + LocationName = locationName; + FailoverPriority = failoverPriority; + } + + /// The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. + public string Id { get; } + /// The name of the region in which the database account exists. + public string LocationName { get; set; } + /// The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + public int? FailoverPriority { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..090addede4a6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.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.ResourceManager.CosmosDB.Models +{ + public partial class GremlinDatabaseCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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("resource"); + writer.WriteObjectValue(Resource); + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static GremlinDatabaseCreateUpdateParameters DeserializeGremlinDatabaseCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + GremlinDatabaseResource resource = default; + CreateUpdateOptions options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = GremlinDatabaseResource.DeserializeGremlinDatabaseResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new GremlinDatabaseCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.cs new file mode 100644 index 000000000000..c4e3232b1762 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB Gremlin database. + public partial class GremlinDatabaseCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of GremlinDatabaseCreateUpdateParameters. + /// The standard JSON format of a Gremlin database. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + /// or is null. + public GremlinDatabaseCreateUpdateParameters(GremlinDatabaseResource resource, CreateUpdateOptions options) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + Resource = resource; + Options = options; + } + + /// Initializes a new instance of GremlinDatabaseCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The standard JSON format of a Gremlin database. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal GremlinDatabaseCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, GremlinDatabaseResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a Gremlin database. + public GremlinDatabaseResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesOptions.Serialization.cs new file mode 100644 index 000000000000..85473db976d1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesOptions.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GremlinDatabaseGetPropertiesOptions + { + internal static GremlinDatabaseGetPropertiesOptions DeserializeGremlinDatabaseGetPropertiesOptions(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); + continue; + } + } + return new GremlinDatabaseGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesOptions.cs new file mode 100644 index 000000000000..ae38f516b1cf --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesOptions.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The GremlinDatabaseGetPropertiesOptions. + public partial class GremlinDatabaseGetPropertiesOptions : OptionsResource + { + /// Initializes a new instance of GremlinDatabaseGetPropertiesOptions. + internal GremlinDatabaseGetPropertiesOptions() + { + } + + /// Initializes a new instance of GremlinDatabaseGetPropertiesOptions. + /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. + /// Specifies the Autoscale settings. + internal GremlinDatabaseGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..983669c95662 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GremlinDatabaseGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WriteEndObject(); + } + + internal static GremlinDatabaseGetPropertiesResource DeserializeGremlinDatabaseGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new GremlinDatabaseGetPropertiesResource(id, Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.cs new file mode 100644 index 000000000000..a473d082cf52 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The GremlinDatabaseGetPropertiesResource. + public partial class GremlinDatabaseGetPropertiesResource : GremlinDatabaseResource + { + /// Initializes a new instance of GremlinDatabaseGetPropertiesResource. + /// Name of the Cosmos DB Gremlin database. + /// is null. + public GremlinDatabaseGetPropertiesResource(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of GremlinDatabaseGetPropertiesResource. + /// Name of the Cosmos DB Gremlin database. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + /// is null. + internal GremlinDatabaseGetPropertiesResource(string id, string rid, object ts, string etag) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.Serialization.cs new file mode 100644 index 000000000000..4378dc4570a5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.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.ResourceManager.CosmosDB.Models +{ + public partial class GremlinDatabaseGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static GremlinDatabaseGetResults DeserializeGremlinDatabaseGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional resource = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = GremlinDatabaseGetPropertiesResource.DeserializeGremlinDatabaseGetPropertiesResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = OptionsResource.DeserializeOptionsResource(property0.Value); + continue; + } + } + continue; + } + } + return new GremlinDatabaseGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.cs new file mode 100644 index 000000000000..a52300702404 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.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.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB Gremlin database. + public partial class GremlinDatabaseGetResults : ARMResourceProperties + { + /// Initializes a new instance of GremlinDatabaseGetResults. + public GremlinDatabaseGetResults() + { + } + + /// Initializes a new instance of GremlinDatabaseGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// . + /// Cosmos DB options resource object. + internal GremlinDatabaseGetResults(string id, string name, string type, string location, IDictionary tags, GremlinDatabaseGetPropertiesResource resource, OptionsResource options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + public GremlinDatabaseGetPropertiesResource Resource { get; set; } + /// Cosmos DB options resource object. + public OptionsResource Options { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.Serialization.cs new file mode 100644 index 000000000000..5e890beaa62e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GremlinDatabaseListResult + { + internal static GremlinDatabaseListResult DeserializeGremlinDatabaseListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GremlinDatabaseGetResults.DeserializeGremlinDatabaseGetResults(item)); + } + value = array; + continue; + } + } + return new GremlinDatabaseListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.cs new file mode 100644 index 000000000000..e8aedf10b748 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the Gremlin databases and their properties. + public partial class GremlinDatabaseListResult + { + /// Initializes a new instance of GremlinDatabaseListResult. + internal GremlinDatabaseListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of GremlinDatabaseListResult. + /// List of Gremlin databases and their properties. + internal GremlinDatabaseListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of Gremlin databases and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResource.Serialization.cs new file mode 100644 index 000000000000..301a8132ca51 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResource.Serialization.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GremlinDatabaseResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WriteEndObject(); + } + + internal static GremlinDatabaseResource DeserializeGremlinDatabaseResource(JsonElement element) + { + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new GremlinDatabaseResource(id); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResource.cs new file mode 100644 index 000000000000..1c871bf47bbf --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB Gremlin database resource object. + public partial class GremlinDatabaseResource + { + /// Initializes a new instance of GremlinDatabaseResource. + /// Name of the Cosmos DB Gremlin database. + /// is null. + public GremlinDatabaseResource(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + } + + /// Name of the Cosmos DB Gremlin database. + public string Id { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..92ce6f87c3f5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.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.ResourceManager.CosmosDB.Models +{ + public partial class GremlinGraphCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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("resource"); + writer.WriteObjectValue(Resource); + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static GremlinGraphCreateUpdateParameters DeserializeGremlinGraphCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + GremlinGraphResource resource = default; + CreateUpdateOptions options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = GremlinGraphResource.DeserializeGremlinGraphResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new GremlinGraphCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.cs new file mode 100644 index 000000000000..c7e490aafdb3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB Gremlin graph. + public partial class GremlinGraphCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of GremlinGraphCreateUpdateParameters. + /// The standard JSON format of a Gremlin graph. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + /// or is null. + public GremlinGraphCreateUpdateParameters(GremlinGraphResource resource, CreateUpdateOptions options) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + Resource = resource; + Options = options; + } + + /// Initializes a new instance of GremlinGraphCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The standard JSON format of a Gremlin graph. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal GremlinGraphCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, GremlinGraphResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a Gremlin graph. + public GremlinGraphResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesOptions.Serialization.cs new file mode 100644 index 000000000000..a31c28516cd5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesOptions.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GremlinGraphGetPropertiesOptions + { + internal static GremlinGraphGetPropertiesOptions DeserializeGremlinGraphGetPropertiesOptions(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); + continue; + } + } + return new GremlinGraphGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesOptions.cs new file mode 100644 index 000000000000..857c59e45bc2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesOptions.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The GremlinGraphGetPropertiesOptions. + public partial class GremlinGraphGetPropertiesOptions : OptionsResource + { + /// Initializes a new instance of GremlinGraphGetPropertiesOptions. + internal GremlinGraphGetPropertiesOptions() + { + } + + /// Initializes a new instance of GremlinGraphGetPropertiesOptions. + /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. + /// Specifies the Autoscale settings. + internal GremlinGraphGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..28573e488745 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.Serialization.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GremlinGraphGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsDefined(IndexingPolicy)) + { + writer.WritePropertyName("indexingPolicy"); + writer.WriteObjectValue(IndexingPolicy); + } + if (Optional.IsDefined(PartitionKey)) + { + writer.WritePropertyName("partitionKey"); + writer.WriteObjectValue(PartitionKey); + } + if (Optional.IsDefined(DefaultTtl)) + { + writer.WritePropertyName("defaultTtl"); + writer.WriteNumberValue(DefaultTtl.Value); + } + if (Optional.IsDefined(UniqueKeyPolicy)) + { + writer.WritePropertyName("uniqueKeyPolicy"); + writer.WriteObjectValue(UniqueKeyPolicy); + } + if (Optional.IsDefined(ConflictResolutionPolicy)) + { + writer.WritePropertyName("conflictResolutionPolicy"); + writer.WriteObjectValue(ConflictResolutionPolicy); + } + writer.WriteEndObject(); + } + + internal static GremlinGraphGetPropertiesResource DeserializeGremlinGraphGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + Optional indexingPolicy = default; + Optional partitionKey = default; + Optional defaultTtl = default; + Optional uniqueKeyPolicy = default; + Optional conflictResolutionPolicy = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("indexingPolicy")) + { + indexingPolicy = IndexingPolicy.DeserializeIndexingPolicy(property.Value); + continue; + } + if (property.NameEquals("partitionKey")) + { + partitionKey = ContainerPartitionKey.DeserializeContainerPartitionKey(property.Value); + continue; + } + if (property.NameEquals("defaultTtl")) + { + defaultTtl = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("uniqueKeyPolicy")) + { + uniqueKeyPolicy = UniqueKeyPolicy.DeserializeUniqueKeyPolicy(property.Value); + continue; + } + if (property.NameEquals("conflictResolutionPolicy")) + { + conflictResolutionPolicy = ConflictResolutionPolicy.DeserializeConflictResolutionPolicy(property.Value); + continue; + } + } + return new GremlinGraphGetPropertiesResource(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.cs new file mode 100644 index 000000000000..86fedb392bfe --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The GremlinGraphGetPropertiesResource. + public partial class GremlinGraphGetPropertiesResource : GremlinGraphResource + { + /// Initializes a new instance of GremlinGraphGetPropertiesResource. + /// Name of the Cosmos DB Gremlin graph. + /// is null. + public GremlinGraphGetPropertiesResource(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of GremlinGraphGetPropertiesResource. + /// Name of the Cosmos DB Gremlin graph. + /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph. + /// The configuration of the partition key to be used for partitioning data into multiple partitions. + /// Default time to live. + /// The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + /// The conflict resolution policy for the graph. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + internal GremlinGraphGetPropertiesResource(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int? defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, string rid, object ts, string etag) : base(id, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy) + { + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.Serialization.cs new file mode 100644 index 000000000000..868ca7603459 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.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.ResourceManager.CosmosDB.Models +{ + public partial class GremlinGraphGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static GremlinGraphGetResults DeserializeGremlinGraphGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional resource = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = GremlinGraphGetPropertiesResource.DeserializeGremlinGraphGetPropertiesResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = OptionsResource.DeserializeOptionsResource(property0.Value); + continue; + } + } + continue; + } + } + return new GremlinGraphGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.cs new file mode 100644 index 000000000000..32d72499f55d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.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.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB Gremlin graph. + public partial class GremlinGraphGetResults : ARMResourceProperties + { + /// Initializes a new instance of GremlinGraphGetResults. + public GremlinGraphGetResults() + { + } + + /// Initializes a new instance of GremlinGraphGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// . + /// Cosmos DB options resource object. + internal GremlinGraphGetResults(string id, string name, string type, string location, IDictionary tags, GremlinGraphGetPropertiesResource resource, OptionsResource options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + public GremlinGraphGetPropertiesResource Resource { get; set; } + /// Cosmos DB options resource object. + public OptionsResource Options { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.Serialization.cs new file mode 100644 index 000000000000..83fa1fb3fbe8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GremlinGraphListResult + { + internal static GremlinGraphListResult DeserializeGremlinGraphListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GremlinGraphGetResults.DeserializeGremlinGraphGetResults(item)); + } + value = array; + continue; + } + } + return new GremlinGraphListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.cs new file mode 100644 index 000000000000..f49dfbed5879 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the graphs and their properties. + public partial class GremlinGraphListResult + { + /// Initializes a new instance of GremlinGraphListResult. + internal GremlinGraphListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of GremlinGraphListResult. + /// List of graphs and their properties. + internal GremlinGraphListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of graphs and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResource.Serialization.cs new file mode 100644 index 000000000000..ff1e44fc4b20 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResource.Serialization.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GremlinGraphResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsDefined(IndexingPolicy)) + { + writer.WritePropertyName("indexingPolicy"); + writer.WriteObjectValue(IndexingPolicy); + } + if (Optional.IsDefined(PartitionKey)) + { + writer.WritePropertyName("partitionKey"); + writer.WriteObjectValue(PartitionKey); + } + if (Optional.IsDefined(DefaultTtl)) + { + writer.WritePropertyName("defaultTtl"); + writer.WriteNumberValue(DefaultTtl.Value); + } + if (Optional.IsDefined(UniqueKeyPolicy)) + { + writer.WritePropertyName("uniqueKeyPolicy"); + writer.WriteObjectValue(UniqueKeyPolicy); + } + if (Optional.IsDefined(ConflictResolutionPolicy)) + { + writer.WritePropertyName("conflictResolutionPolicy"); + writer.WriteObjectValue(ConflictResolutionPolicy); + } + writer.WriteEndObject(); + } + + internal static GremlinGraphResource DeserializeGremlinGraphResource(JsonElement element) + { + string id = default; + Optional indexingPolicy = default; + Optional partitionKey = default; + Optional defaultTtl = default; + Optional uniqueKeyPolicy = default; + Optional conflictResolutionPolicy = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("indexingPolicy")) + { + indexingPolicy = IndexingPolicy.DeserializeIndexingPolicy(property.Value); + continue; + } + if (property.NameEquals("partitionKey")) + { + partitionKey = ContainerPartitionKey.DeserializeContainerPartitionKey(property.Value); + continue; + } + if (property.NameEquals("defaultTtl")) + { + defaultTtl = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("uniqueKeyPolicy")) + { + uniqueKeyPolicy = UniqueKeyPolicy.DeserializeUniqueKeyPolicy(property.Value); + continue; + } + if (property.NameEquals("conflictResolutionPolicy")) + { + conflictResolutionPolicy = ConflictResolutionPolicy.DeserializeConflictResolutionPolicy(property.Value); + continue; + } + } + return new GremlinGraphResource(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResource.cs new file mode 100644 index 000000000000..2f22c26e5e55 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResource.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB Gremlin graph resource object. + public partial class GremlinGraphResource + { + /// Initializes a new instance of GremlinGraphResource. + /// Name of the Cosmos DB Gremlin graph. + /// is null. + public GremlinGraphResource(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + } + + /// Initializes a new instance of GremlinGraphResource. + /// Name of the Cosmos DB Gremlin graph. + /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph. + /// The configuration of the partition key to be used for partitioning data into multiple partitions. + /// Default time to live. + /// The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + /// The conflict resolution policy for the graph. + internal GremlinGraphResource(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int? defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy) + { + Id = id; + IndexingPolicy = indexingPolicy; + PartitionKey = partitionKey; + DefaultTtl = defaultTtl; + UniqueKeyPolicy = uniqueKeyPolicy; + ConflictResolutionPolicy = conflictResolutionPolicy; + } + + /// Name of the Cosmos DB Gremlin graph. + public string Id { get; set; } + /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph. + public IndexingPolicy IndexingPolicy { get; set; } + /// The configuration of the partition key to be used for partitioning data into multiple partitions. + public ContainerPartitionKey PartitionKey { get; set; } + /// Default time to live. + public int? DefaultTtl { get; set; } + /// The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + /// The conflict resolution policy for the graph. + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IncludedPath.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IncludedPath.Serialization.cs new file mode 100644 index 000000000000..d311135e6e09 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IncludedPath.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class IncludedPath : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"); + writer.WriteStringValue(Path); + } + if (Optional.IsCollectionDefined(Indexes)) + { + writer.WritePropertyName("indexes"); + writer.WriteStartArray(); + foreach (var item in Indexes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static IncludedPath DeserializeIncludedPath(JsonElement element) + { + Optional path = default; + Optional> indexes = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("path")) + { + path = property.Value.GetString(); + continue; + } + if (property.NameEquals("indexes")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.Indexes.DeserializeIndexes(item)); + } + indexes = array; + continue; + } + } + return new IncludedPath(path.Value, Optional.ToList(indexes)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IncludedPath.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IncludedPath.cs new file mode 100644 index 000000000000..e9e7cb72d64b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IncludedPath.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The paths that are included in indexing. + public partial class IncludedPath + { + /// Initializes a new instance of IncludedPath. + public IncludedPath() + { + Indexes = new ChangeTrackingList(); + } + + /// Initializes a new instance of IncludedPath. + /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + /// List of indexes for this path. + internal IncludedPath(string path, IList indexes) + { + Path = path; + Indexes = indexes; + } + + /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + public string Path { get; set; } + /// List of indexes for this path. + public IList Indexes { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexKind.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexKind.cs new file mode 100644 index 000000000000..6ec980af0967 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexKind.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Indicates the type of index. + public readonly partial struct IndexKind : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public IndexKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string HashValue = "Hash"; + private const string RangeValue = "Range"; + private const string SpatialValue = "Spatial"; + + /// Hash. + public static IndexKind Hash { get; } = new IndexKind(HashValue); + /// Range. + public static IndexKind Range { get; } = new IndexKind(RangeValue); + /// Spatial. + public static IndexKind Spatial { get; } = new IndexKind(SpatialValue); + /// Determines if two values are the same. + public static bool operator ==(IndexKind left, IndexKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(IndexKind left, IndexKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator IndexKind(string value) => new IndexKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is IndexKind other && Equals(other); + /// + public bool Equals(IndexKind 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Indexes.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Indexes.Serialization.cs new file mode 100644 index 000000000000..277ee4e18e64 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Indexes.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class Indexes : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DataType)) + { + writer.WritePropertyName("dataType"); + writer.WriteStringValue(DataType.Value.ToString()); + } + if (Optional.IsDefined(Precision)) + { + writer.WritePropertyName("precision"); + writer.WriteNumberValue(Precision.Value); + } + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static Indexes DeserializeIndexes(JsonElement element) + { + Optional dataType = default; + Optional precision = default; + Optional kind = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dataType")) + { + dataType = new DataType(property.Value.GetString()); + continue; + } + if (property.NameEquals("precision")) + { + precision = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("kind")) + { + kind = new IndexKind(property.Value.GetString()); + continue; + } + } + return new Indexes(Optional.ToNullable(dataType), Optional.ToNullable(precision), Optional.ToNullable(kind)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Indexes.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Indexes.cs new file mode 100644 index 000000000000..82bc9c2b4f50 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Indexes.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The indexes for the path. + public partial class Indexes + { + /// Initializes a new instance of Indexes. + public Indexes() + { + } + + /// Initializes a new instance of Indexes. + /// The datatype for which the indexing behavior is applied to. + /// The precision of the index. -1 is maximum precision. + /// Indicates the type of index. + internal Indexes(DataType? dataType, int? precision, IndexKind? kind) + { + DataType = dataType; + Precision = precision; + Kind = kind; + } + + /// The datatype for which the indexing behavior is applied to. + public DataType? DataType { get; set; } + /// The precision of the index. -1 is maximum precision. + public int? Precision { get; set; } + /// Indicates the type of index. + public IndexKind? Kind { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexingMode.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexingMode.cs new file mode 100644 index 000000000000..8a13d561f11b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexingMode.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Indicates the indexing mode. + public readonly partial struct IndexingMode : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public IndexingMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ConsistentValue = "Consistent"; + private const string LazyValue = "Lazy"; + private const string NoneValue = "None"; + + /// Consistent. + public static IndexingMode Consistent { get; } = new IndexingMode(ConsistentValue); + /// Lazy. + public static IndexingMode Lazy { get; } = new IndexingMode(LazyValue); + /// None. + public static IndexingMode None { get; } = new IndexingMode(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(IndexingMode left, IndexingMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(IndexingMode left, IndexingMode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator IndexingMode(string value) => new IndexingMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is IndexingMode other && Equals(other); + /// + public bool Equals(IndexingMode 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexingPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexingPolicy.Serialization.cs new file mode 100644 index 000000000000..9f0037b33389 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexingPolicy.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.ResourceManager.CosmosDB.Models +{ + public partial class IndexingPolicy : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Automatic)) + { + writer.WritePropertyName("automatic"); + writer.WriteBooleanValue(Automatic.Value); + } + if (Optional.IsDefined(IndexingMode)) + { + writer.WritePropertyName("indexingMode"); + writer.WriteStringValue(IndexingMode.Value.ToString()); + } + if (Optional.IsCollectionDefined(IncludedPaths)) + { + writer.WritePropertyName("includedPaths"); + writer.WriteStartArray(); + foreach (var item in IncludedPaths) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ExcludedPaths)) + { + writer.WritePropertyName("excludedPaths"); + writer.WriteStartArray(); + foreach (var item in ExcludedPaths) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(CompositeIndexes)) + { + writer.WritePropertyName("compositeIndexes"); + writer.WriteStartArray(); + foreach (var item in CompositeIndexes) + { + writer.WriteStartArray(); + foreach (var item0 in item) + { + writer.WriteObjectValue(item0); + } + writer.WriteEndArray(); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SpatialIndexes)) + { + writer.WritePropertyName("spatialIndexes"); + writer.WriteStartArray(); + foreach (var item in SpatialIndexes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static IndexingPolicy DeserializeIndexingPolicy(JsonElement element) + { + Optional automatic = default; + Optional indexingMode = default; + Optional> includedPaths = default; + Optional> excludedPaths = default; + Optional>> compositeIndexes = default; + Optional> spatialIndexes = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("automatic")) + { + automatic = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("indexingMode")) + { + indexingMode = new IndexingMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("includedPaths")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(IncludedPath.DeserializeIncludedPath(item)); + } + includedPaths = array; + continue; + } + if (property.NameEquals("excludedPaths")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ExcludedPath.DeserializeExcludedPath(item)); + } + excludedPaths = array; + continue; + } + if (property.NameEquals("compositeIndexes")) + { + List> array = new List>(); + foreach (var item in property.Value.EnumerateArray()) + { + List array0 = new List(); + foreach (var item0 in item.EnumerateArray()) + { + array0.Add(CompositePath.DeserializeCompositePath(item0)); + } + array.Add(array0); + } + compositeIndexes = array; + continue; + } + if (property.NameEquals("spatialIndexes")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SpatialSpec.DeserializeSpatialSpec(item)); + } + spatialIndexes = array; + continue; + } + } + return new IndexingPolicy(Optional.ToNullable(automatic), Optional.ToNullable(indexingMode), Optional.ToList(includedPaths), Optional.ToList(excludedPaths), Optional.ToList(compositeIndexes), Optional.ToList(spatialIndexes)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexingPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexingPolicy.cs new file mode 100644 index 000000000000..c2cebf93e7ca --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexingPolicy.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB indexing policy. + public partial class IndexingPolicy + { + /// Initializes a new instance of IndexingPolicy. + public IndexingPolicy() + { + IncludedPaths = new ChangeTrackingList(); + ExcludedPaths = new ChangeTrackingList(); + CompositeIndexes = new ChangeTrackingList>(); + SpatialIndexes = new ChangeTrackingList(); + } + + /// Initializes a new instance of IndexingPolicy. + /// Indicates if the indexing policy is automatic. + /// Indicates the indexing mode. + /// List of paths to include in the indexing. + /// List of paths to exclude from indexing. + /// List of composite path list. + /// List of spatial specifics. + internal IndexingPolicy(bool? automatic, IndexingMode? indexingMode, IList includedPaths, IList excludedPaths, IList> compositeIndexes, IList spatialIndexes) + { + Automatic = automatic; + IndexingMode = indexingMode; + IncludedPaths = includedPaths; + ExcludedPaths = excludedPaths; + CompositeIndexes = compositeIndexes; + SpatialIndexes = spatialIndexes; + } + + /// Indicates if the indexing policy is automatic. + public bool? Automatic { get; set; } + /// Indicates the indexing mode. + public IndexingMode? IndexingMode { get; set; } + /// List of paths to include in the indexing. + public IList IncludedPaths { get; } + /// List of paths to exclude from indexing. + public IList ExcludedPaths { get; } + /// List of composite path list. + public IList> CompositeIndexes { get; } + /// List of spatial specifics. + public IList SpatialIndexes { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IpAddressOrRange.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IpAddressOrRange.Serialization.cs new file mode 100644 index 000000000000..66661b1ea645 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IpAddressOrRange.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class IpAddressOrRange : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(IpAddressOrRangeValue)) + { + writer.WritePropertyName("ipAddressOrRange"); + writer.WriteStringValue(IpAddressOrRangeValue); + } + writer.WriteEndObject(); + } + + internal static IpAddressOrRange DeserializeIpAddressOrRange(JsonElement element) + { + Optional ipAddressOrRange = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ipAddressOrRange")) + { + ipAddressOrRange = property.Value.GetString(); + continue; + } + } + return new IpAddressOrRange(ipAddressOrRange.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IpAddressOrRange.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IpAddressOrRange.cs new file mode 100644 index 000000000000..d46c3f95180b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IpAddressOrRange.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// IpAddressOrRange object. + public partial class IpAddressOrRange + { + /// Initializes a new instance of IpAddressOrRange. + public IpAddressOrRange() + { + } + + /// Initializes a new instance of IpAddressOrRange. + /// A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. + internal IpAddressOrRange(string ipAddressOrRangeValue) + { + IpAddressOrRangeValue = ipAddressOrRangeValue; + } + + /// A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. + public string IpAddressOrRangeValue { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/KeyKind.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/KeyKind.cs new file mode 100644 index 000000000000..b44232bb85cb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/KeyKind.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The access key to regenerate. + public readonly partial struct KeyKind : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public KeyKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PrimaryValue = "primary"; + private const string SecondaryValue = "secondary"; + private const string PrimaryReadonlyValue = "primaryReadonly"; + private const string SecondaryReadonlyValue = "secondaryReadonly"; + + /// primary. + public static KeyKind Primary { get; } = new KeyKind(PrimaryValue); + /// secondary. + public static KeyKind Secondary { get; } = new KeyKind(SecondaryValue); + /// primaryReadonly. + public static KeyKind PrimaryReadonly { get; } = new KeyKind(PrimaryReadonlyValue); + /// secondaryReadonly. + public static KeyKind SecondaryReadonly { get; } = new KeyKind(SecondaryReadonlyValue); + /// Determines if two values are the same. + public static bool operator ==(KeyKind left, KeyKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(KeyKind left, KeyKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator KeyKind(string value) => new KeyKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is KeyKind other && Equals(other); + /// + public bool Equals(KeyKind 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Location.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Location.Serialization.cs new file mode 100644 index 000000000000..e4d8d523fa34 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Location.Serialization.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class Location : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(LocationName)) + { + writer.WritePropertyName("locationName"); + writer.WriteStringValue(LocationName); + } + if (Optional.IsDefined(FailoverPriority)) + { + writer.WritePropertyName("failoverPriority"); + writer.WriteNumberValue(FailoverPriority.Value); + } + if (Optional.IsDefined(IsZoneRedundant)) + { + writer.WritePropertyName("isZoneRedundant"); + writer.WriteBooleanValue(IsZoneRedundant.Value); + } + writer.WriteEndObject(); + } + + internal static Location DeserializeLocation(JsonElement element) + { + Optional id = default; + Optional locationName = default; + Optional documentEndpoint = default; + Optional provisioningState = default; + Optional failoverPriority = default; + Optional isZoneRedundant = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("locationName")) + { + locationName = property.Value.GetString(); + continue; + } + if (property.NameEquals("documentEndpoint")) + { + documentEndpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState")) + { + provisioningState = property.Value.GetString(); + continue; + } + if (property.NameEquals("failoverPriority")) + { + failoverPriority = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("isZoneRedundant")) + { + isZoneRedundant = property.Value.GetBoolean(); + continue; + } + } + return new Location(id.Value, locationName.Value, documentEndpoint.Value, provisioningState.Value, Optional.ToNullable(failoverPriority), Optional.ToNullable(isZoneRedundant)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Location.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Location.cs new file mode 100644 index 000000000000..39f74485bd3f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/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.ResourceManager.CosmosDB.Models +{ + /// A region in which the Azure Cosmos DB database account is deployed. + public partial class Location + { + /// Initializes a new instance of Location. + public Location() + { + } + + /// Initializes a new instance of Location. + /// The unique identifier of the region within the database account. Example: <accountName>-<locationName>. + /// The name of the region. + /// The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/. + /// The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB account deletion failed. + /// The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + /// Flag to indicate whether or not this region is an AvailabilityZone region. + internal Location(string id, string locationName, string documentEndpoint, string provisioningState, int? failoverPriority, bool? isZoneRedundant) + { + Id = id; + LocationName = locationName; + DocumentEndpoint = documentEndpoint; + ProvisioningState = provisioningState; + FailoverPriority = failoverPriority; + IsZoneRedundant = isZoneRedundant; + } + + /// The unique identifier of the region within the database account. Example: <accountName>-<locationName>. + public string Id { get; } + /// The name of the region. + public string LocationName { get; set; } + /// The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/. + public string DocumentEndpoint { get; } + /// The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB account deletion failed. + public string ProvisioningState { get; } + /// The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + public int? FailoverPriority { get; set; } + /// Flag to indicate whether or not this region is an AvailabilityZone region. + public bool? IsZoneRedundant { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Metric.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Metric.Serialization.cs new file mode 100644 index 000000000000..3ca1348953eb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Metric.Serialization.cs @@ -0,0 +1,66 @@ +// 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.ResourceManager.CosmosDB.Models +{ + public partial class Metric + { + internal static Metric DeserializeMetric(JsonElement element) + { + Optional startTime = default; + Optional endTime = default; + Optional timeGrain = default; + Optional unit = default; + Optional name = default; + Optional> metricValues = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("startTime")) + { + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime")) + { + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("timeGrain")) + { + timeGrain = property.Value.GetString(); + continue; + } + if (property.NameEquals("unit")) + { + unit = new UnitType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = MetricName.DeserializeMetricName(property.Value); + continue; + } + if (property.NameEquals("metricValues")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MetricValue.DeserializeMetricValue(item)); + } + metricValues = array; + continue; + } + } + return new Metric(Optional.ToNullable(startTime), Optional.ToNullable(endTime), timeGrain.Value, Optional.ToNullable(unit), name.Value, Optional.ToList(metricValues)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Metric.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Metric.cs new file mode 100644 index 000000000000..a1e40b823094 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Metric.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Metric data. + public partial class Metric + { + /// Initializes a new instance of Metric. + internal Metric() + { + MetricValues = new ChangeTrackingList(); + } + + /// Initializes a new instance of Metric. + /// The start time for the metric (ISO-8601 format). + /// The end time for the metric (ISO-8601 format). + /// The time grain to be used to summarize the metric values. + /// The unit of the metric. + /// The name information for the metric. + /// The metric values for the specified time window and timestep. + internal Metric(DateTimeOffset? startTime, DateTimeOffset? endTime, string timeGrain, UnitType? unit, MetricName name, IReadOnlyList metricValues) + { + StartTime = startTime; + EndTime = endTime; + TimeGrain = timeGrain; + Unit = unit; + Name = name; + MetricValues = metricValues; + } + + /// The start time for the metric (ISO-8601 format). + public DateTimeOffset? StartTime { get; } + /// The end time for the metric (ISO-8601 format). + public DateTimeOffset? EndTime { get; } + /// The time grain to be used to summarize the metric values. + public string TimeGrain { get; } + /// The unit of the metric. + public UnitType? Unit { get; } + /// The name information for the metric. + public MetricName Name { get; } + /// The metric values for the specified time window and timestep. + public IReadOnlyList MetricValues { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricAvailability.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricAvailability.Serialization.cs new file mode 100644 index 000000000000..053521b1957b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricAvailability.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MetricAvailability + { + internal static MetricAvailability DeserializeMetricAvailability(JsonElement element) + { + Optional timeGrain = default; + Optional retention = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("timeGrain")) + { + timeGrain = property.Value.GetString(); + continue; + } + if (property.NameEquals("retention")) + { + retention = property.Value.GetString(); + continue; + } + } + return new MetricAvailability(timeGrain.Value, retention.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricAvailability.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricAvailability.cs new file mode 100644 index 000000000000..b01b9d7bb9d3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricAvailability.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The availability of the metric. + public partial class MetricAvailability + { + /// Initializes a new instance of MetricAvailability. + internal MetricAvailability() + { + } + + /// Initializes a new instance of MetricAvailability. + /// The time grain to be used to summarize the metric values. + /// The retention for the metric values. + internal MetricAvailability(string timeGrain, string retention) + { + TimeGrain = timeGrain; + Retention = retention; + } + + /// The time grain to be used to summarize the metric values. + public string TimeGrain { get; } + /// The retention for the metric values. + public string Retention { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricDefinition.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricDefinition.Serialization.cs new file mode 100644 index 000000000000..0598d440bab1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricDefinition.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MetricDefinition + { + internal static MetricDefinition DeserializeMetricDefinition(JsonElement element) + { + Optional> metricAvailabilities = default; + Optional primaryAggregationType = default; + Optional unit = default; + Optional resourceUri = default; + Optional name = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metricAvailabilities")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MetricAvailability.DeserializeMetricAvailability(item)); + } + metricAvailabilities = array; + continue; + } + if (property.NameEquals("primaryAggregationType")) + { + primaryAggregationType = new PrimaryAggregationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("unit")) + { + unit = new UnitType(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceUri")) + { + resourceUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = MetricName.DeserializeMetricName(property.Value); + continue; + } + } + return new MetricDefinition(Optional.ToList(metricAvailabilities), Optional.ToNullable(primaryAggregationType), Optional.ToNullable(unit), resourceUri.Value, name.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricDefinition.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricDefinition.cs new file mode 100644 index 000000000000..72b33084e0ad --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricDefinition.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The definition of a metric. + public partial class MetricDefinition + { + /// Initializes a new instance of MetricDefinition. + internal MetricDefinition() + { + MetricAvailabilities = new ChangeTrackingList(); + } + + /// Initializes a new instance of MetricDefinition. + /// The list of metric availabilities for the account. + /// The primary aggregation type of the metric. + /// The unit of the metric. + /// The resource uri of the database. + /// The name information for the metric. + internal MetricDefinition(IReadOnlyList metricAvailabilities, PrimaryAggregationType? primaryAggregationType, UnitType? unit, string resourceUri, MetricName name) + { + MetricAvailabilities = metricAvailabilities; + PrimaryAggregationType = primaryAggregationType; + Unit = unit; + ResourceUri = resourceUri; + Name = name; + } + + /// The list of metric availabilities for the account. + public IReadOnlyList MetricAvailabilities { get; } + /// The primary aggregation type of the metric. + public PrimaryAggregationType? PrimaryAggregationType { get; } + /// The unit of the metric. + public UnitType? Unit { get; } + /// The resource uri of the database. + public string ResourceUri { get; } + /// The name information for the metric. + public MetricName Name { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricDefinitionsListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricDefinitionsListResult.Serialization.cs new file mode 100644 index 000000000000..e296b5668352 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricDefinitionsListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MetricDefinitionsListResult + { + internal static MetricDefinitionsListResult DeserializeMetricDefinitionsListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MetricDefinition.DeserializeMetricDefinition(item)); + } + value = array; + continue; + } + } + return new MetricDefinitionsListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricDefinitionsListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricDefinitionsListResult.cs new file mode 100644 index 000000000000..d73c8e07be93 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricDefinitionsListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The response to a list metric definitions request. + public partial class MetricDefinitionsListResult + { + /// Initializes a new instance of MetricDefinitionsListResult. + internal MetricDefinitionsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of MetricDefinitionsListResult. + /// The list of metric definitions for the account. + internal MetricDefinitionsListResult(IReadOnlyList value) + { + Value = value; + } + + /// The list of metric definitions for the account. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricListResult.Serialization.cs new file mode 100644 index 000000000000..fa316c2b4297 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MetricListResult + { + internal static MetricListResult DeserializeMetricListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Metric.DeserializeMetric(item)); + } + value = array; + continue; + } + } + return new MetricListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricListResult.cs new file mode 100644 index 000000000000..e93b00036500 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The response to a list metrics request. + public partial class MetricListResult + { + /// Initializes a new instance of MetricListResult. + internal MetricListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of MetricListResult. + /// The list of metrics for the account. + internal MetricListResult(IReadOnlyList value) + { + Value = value; + } + + /// The list of metrics for the account. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricName.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricName.Serialization.cs new file mode 100644 index 000000000000..54e33bcc5169 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricName.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MetricName + { + internal static MetricName DeserializeMetricName(JsonElement element) + { + Optional value = default; + Optional localizedValue = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("localizedValue")) + { + localizedValue = property.Value.GetString(); + continue; + } + } + return new MetricName(value.Value, localizedValue.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricName.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricName.cs new file mode 100644 index 000000000000..0a233a67316c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricName.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// A metric name. + public partial class MetricName + { + /// Initializes a new instance of MetricName. + internal MetricName() + { + } + + /// Initializes a new instance of MetricName. + /// The name of the metric. + /// The friendly name of the metric. + internal MetricName(string value, string localizedValue) + { + Value = value; + LocalizedValue = localizedValue; + } + + /// The name of the metric. + public string Value { get; } + /// The friendly name of the metric. + public string LocalizedValue { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricValue.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricValue.Serialization.cs new file mode 100644 index 000000000000..3ca63832019a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricValue.Serialization.cs @@ -0,0 +1,60 @@ +// 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.ResourceManager.CosmosDB.Models +{ + public partial class MetricValue + { + internal static MetricValue DeserializeMetricValue(JsonElement element) + { + Optional Count = default; + Optional average = default; + Optional maximum = default; + Optional minimum = default; + Optional timestamp = default; + Optional total = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_count")) + { + Count = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("average")) + { + average = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("maximum")) + { + maximum = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("minimum")) + { + minimum = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("timestamp")) + { + timestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("total")) + { + total = property.Value.GetDouble(); + continue; + } + } + return new MetricValue(Optional.ToNullable(Count), Optional.ToNullable(average), Optional.ToNullable(maximum), Optional.ToNullable(minimum), Optional.ToNullable(timestamp), Optional.ToNullable(total)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricValue.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricValue.cs new file mode 100644 index 000000000000..511f7b74d117 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MetricValue.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Represents metrics values. + public partial class MetricValue + { + /// Initializes a new instance of MetricValue. + internal MetricValue() + { + } + + /// Initializes a new instance of MetricValue. + /// The number of values for the metric. + /// The average value of the metric. + /// The max value of the metric. + /// The min value of the metric. + /// The metric timestamp (ISO-8601 format). + /// The total value of the metric. + internal MetricValue(int? count, double? average, double? maximum, double? minimum, DateTimeOffset? timestamp, double? total) + { + Count = count; + Average = average; + Maximum = maximum; + Minimum = minimum; + Timestamp = timestamp; + Total = total; + } + + /// The number of values for the metric. + public int? Count { get; } + /// The average value of the metric. + public double? Average { get; } + /// The max value of the metric. + public double? Maximum { get; } + /// The min value of the metric. + public double? Minimum { get; } + /// The metric timestamp (ISO-8601 format). + public DateTimeOffset? Timestamp { get; } + /// The total value of the metric. + public double? Total { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..430f0f52ac1f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.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.ResourceManager.CosmosDB.Models +{ + public partial class MongoDBCollectionCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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("resource"); + writer.WriteObjectValue(Resource); + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static MongoDBCollectionCreateUpdateParameters DeserializeMongoDBCollectionCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + MongoDBCollectionResource resource = default; + CreateUpdateOptions options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = MongoDBCollectionResource.DeserializeMongoDBCollectionResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new MongoDBCollectionCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.cs new file mode 100644 index 000000000000..a90e34e12680 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB MongoDB collection. + public partial class MongoDBCollectionCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of MongoDBCollectionCreateUpdateParameters. + /// The standard JSON format of a MongoDB collection. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + /// or is null. + public MongoDBCollectionCreateUpdateParameters(MongoDBCollectionResource resource, CreateUpdateOptions options) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + Resource = resource; + Options = options; + } + + /// Initializes a new instance of MongoDBCollectionCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The standard JSON format of a MongoDB collection. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal MongoDBCollectionCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, MongoDBCollectionResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a MongoDB collection. + public MongoDBCollectionResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesOptions.Serialization.cs new file mode 100644 index 000000000000..d0ae3c786219 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesOptions.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MongoDBCollectionGetPropertiesOptions + { + internal static MongoDBCollectionGetPropertiesOptions DeserializeMongoDBCollectionGetPropertiesOptions(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); + continue; + } + } + return new MongoDBCollectionGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesOptions.cs new file mode 100644 index 000000000000..0e8282782dc7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesOptions.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The MongoDBCollectionGetPropertiesOptions. + public partial class MongoDBCollectionGetPropertiesOptions : OptionsResource + { + /// Initializes a new instance of MongoDBCollectionGetPropertiesOptions. + internal MongoDBCollectionGetPropertiesOptions() + { + } + + /// Initializes a new instance of MongoDBCollectionGetPropertiesOptions. + /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. + /// Specifies the Autoscale settings. + internal MongoDBCollectionGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..92702fe7888d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.Serialization.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MongoDBCollectionGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsCollectionDefined(ShardKey)) + { + writer.WritePropertyName("shardKey"); + writer.WriteStartObject(); + foreach (var item in ShardKey) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(Indexes)) + { + writer.WritePropertyName("indexes"); + writer.WriteStartArray(); + foreach (var item in Indexes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(AnalyticalStorageTtl)) + { + writer.WritePropertyName("analyticalStorageTtl"); + writer.WriteNumberValue(AnalyticalStorageTtl.Value); + } + writer.WriteEndObject(); + } + + internal static MongoDBCollectionGetPropertiesResource DeserializeMongoDBCollectionGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + Optional> shardKey = default; + Optional> indexes = default; + Optional analyticalStorageTtl = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("shardKey")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + shardKey = dictionary; + continue; + } + if (property.NameEquals("indexes")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MongoIndex.DeserializeMongoIndex(item)); + } + indexes = array; + continue; + } + if (property.NameEquals("analyticalStorageTtl")) + { + analyticalStorageTtl = property.Value.GetInt32(); + continue; + } + } + return new MongoDBCollectionGetPropertiesResource(id, Optional.ToDictionary(shardKey), Optional.ToList(indexes), Optional.ToNullable(analyticalStorageTtl), Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.cs new file mode 100644 index 000000000000..2a9a7929bbc2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The MongoDBCollectionGetPropertiesResource. + public partial class MongoDBCollectionGetPropertiesResource : MongoDBCollectionResource + { + /// Initializes a new instance of MongoDBCollectionGetPropertiesResource. + /// Name of the Cosmos DB MongoDB collection. + /// is null. + public MongoDBCollectionGetPropertiesResource(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of MongoDBCollectionGetPropertiesResource. + /// Name of the Cosmos DB MongoDB collection. + /// A key-value pair of shard keys to be applied for the request. + /// List of index keys. + /// Analytical TTL. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + internal MongoDBCollectionGetPropertiesResource(string id, IDictionary shardKey, IList indexes, int? analyticalStorageTtl, string rid, object ts, string etag) : base(id, shardKey, indexes, analyticalStorageTtl) + { + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.Serialization.cs new file mode 100644 index 000000000000..b73d01dfef9d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.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.ResourceManager.CosmosDB.Models +{ + public partial class MongoDBCollectionGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static MongoDBCollectionGetResults DeserializeMongoDBCollectionGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional resource = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = MongoDBCollectionGetPropertiesResource.DeserializeMongoDBCollectionGetPropertiesResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = OptionsResource.DeserializeOptionsResource(property0.Value); + continue; + } + } + continue; + } + } + return new MongoDBCollectionGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.cs new file mode 100644 index 000000000000..552d9b3ec26d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.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.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB MongoDB collection. + public partial class MongoDBCollectionGetResults : ARMResourceProperties + { + /// Initializes a new instance of MongoDBCollectionGetResults. + public MongoDBCollectionGetResults() + { + } + + /// Initializes a new instance of MongoDBCollectionGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// . + /// Cosmos DB options resource object. + internal MongoDBCollectionGetResults(string id, string name, string type, string location, IDictionary tags, MongoDBCollectionGetPropertiesResource resource, OptionsResource options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + public MongoDBCollectionGetPropertiesResource Resource { get; set; } + /// Cosmos DB options resource object. + public OptionsResource Options { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.Serialization.cs new file mode 100644 index 000000000000..33e198b02f8d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MongoDBCollectionListResult + { + internal static MongoDBCollectionListResult DeserializeMongoDBCollectionListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MongoDBCollectionGetResults.DeserializeMongoDBCollectionGetResults(item)); + } + value = array; + continue; + } + } + return new MongoDBCollectionListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.cs new file mode 100644 index 000000000000..fe2e655c858f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the MongoDB collections and their properties. + public partial class MongoDBCollectionListResult + { + /// Initializes a new instance of MongoDBCollectionListResult. + internal MongoDBCollectionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of MongoDBCollectionListResult. + /// List of MongoDB collections and their properties. + internal MongoDBCollectionListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of MongoDB collections and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResource.Serialization.cs new file mode 100644 index 000000000000..312e6f6e2c26 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResource.Serialization.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MongoDBCollectionResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsCollectionDefined(ShardKey)) + { + writer.WritePropertyName("shardKey"); + writer.WriteStartObject(); + foreach (var item in ShardKey) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(Indexes)) + { + writer.WritePropertyName("indexes"); + writer.WriteStartArray(); + foreach (var item in Indexes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(AnalyticalStorageTtl)) + { + writer.WritePropertyName("analyticalStorageTtl"); + writer.WriteNumberValue(AnalyticalStorageTtl.Value); + } + writer.WriteEndObject(); + } + + internal static MongoDBCollectionResource DeserializeMongoDBCollectionResource(JsonElement element) + { + string id = default; + Optional> shardKey = default; + Optional> indexes = default; + Optional analyticalStorageTtl = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("shardKey")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + shardKey = dictionary; + continue; + } + if (property.NameEquals("indexes")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MongoIndex.DeserializeMongoIndex(item)); + } + indexes = array; + continue; + } + if (property.NameEquals("analyticalStorageTtl")) + { + analyticalStorageTtl = property.Value.GetInt32(); + continue; + } + } + return new MongoDBCollectionResource(id, Optional.ToDictionary(shardKey), Optional.ToList(indexes), Optional.ToNullable(analyticalStorageTtl)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResource.cs new file mode 100644 index 000000000000..a3e4139aa7eb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResource.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB MongoDB collection resource object. + public partial class MongoDBCollectionResource + { + /// Initializes a new instance of MongoDBCollectionResource. + /// Name of the Cosmos DB MongoDB collection. + /// is null. + public MongoDBCollectionResource(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + ShardKey = new ChangeTrackingDictionary(); + Indexes = new ChangeTrackingList(); + } + + /// Initializes a new instance of MongoDBCollectionResource. + /// Name of the Cosmos DB MongoDB collection. + /// A key-value pair of shard keys to be applied for the request. + /// List of index keys. + /// Analytical TTL. + internal MongoDBCollectionResource(string id, IDictionary shardKey, IList indexes, int? analyticalStorageTtl) + { + Id = id; + ShardKey = shardKey; + Indexes = indexes; + AnalyticalStorageTtl = analyticalStorageTtl; + } + + /// Name of the Cosmos DB MongoDB collection. + public string Id { get; set; } + /// A key-value pair of shard keys to be applied for the request. + public IDictionary ShardKey { get; } + /// List of index keys. + public IList Indexes { get; } + /// Analytical TTL. + public int? AnalyticalStorageTtl { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..f905a024736b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.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.ResourceManager.CosmosDB.Models +{ + public partial class MongoDBDatabaseCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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("resource"); + writer.WriteObjectValue(Resource); + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static MongoDBDatabaseCreateUpdateParameters DeserializeMongoDBDatabaseCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + MongoDBDatabaseResource resource = default; + CreateUpdateOptions options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = MongoDBDatabaseResource.DeserializeMongoDBDatabaseResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new MongoDBDatabaseCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.cs new file mode 100644 index 000000000000..6a5b9699331a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB MongoDB database. + public partial class MongoDBDatabaseCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of MongoDBDatabaseCreateUpdateParameters. + /// The standard JSON format of a MongoDB database. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + /// or is null. + public MongoDBDatabaseCreateUpdateParameters(MongoDBDatabaseResource resource, CreateUpdateOptions options) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + Resource = resource; + Options = options; + } + + /// Initializes a new instance of MongoDBDatabaseCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The standard JSON format of a MongoDB database. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal MongoDBDatabaseCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, MongoDBDatabaseResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a MongoDB database. + public MongoDBDatabaseResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesOptions.Serialization.cs new file mode 100644 index 000000000000..25dba2c60d7c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesOptions.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MongoDBDatabaseGetPropertiesOptions + { + internal static MongoDBDatabaseGetPropertiesOptions DeserializeMongoDBDatabaseGetPropertiesOptions(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); + continue; + } + } + return new MongoDBDatabaseGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesOptions.cs new file mode 100644 index 000000000000..41a27d013f98 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesOptions.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The MongoDBDatabaseGetPropertiesOptions. + public partial class MongoDBDatabaseGetPropertiesOptions : OptionsResource + { + /// Initializes a new instance of MongoDBDatabaseGetPropertiesOptions. + internal MongoDBDatabaseGetPropertiesOptions() + { + } + + /// Initializes a new instance of MongoDBDatabaseGetPropertiesOptions. + /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. + /// Specifies the Autoscale settings. + internal MongoDBDatabaseGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..402c3f320d8e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MongoDBDatabaseGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WriteEndObject(); + } + + internal static MongoDBDatabaseGetPropertiesResource DeserializeMongoDBDatabaseGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new MongoDBDatabaseGetPropertiesResource(id, Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.cs new file mode 100644 index 000000000000..7d5cd689ca2d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The MongoDBDatabaseGetPropertiesResource. + public partial class MongoDBDatabaseGetPropertiesResource : MongoDBDatabaseResource + { + /// Initializes a new instance of MongoDBDatabaseGetPropertiesResource. + /// Name of the Cosmos DB MongoDB database. + /// is null. + public MongoDBDatabaseGetPropertiesResource(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of MongoDBDatabaseGetPropertiesResource. + /// Name of the Cosmos DB MongoDB database. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + /// is null. + internal MongoDBDatabaseGetPropertiesResource(string id, string rid, object ts, string etag) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.Serialization.cs new file mode 100644 index 000000000000..395820ae87c8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.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.ResourceManager.CosmosDB.Models +{ + public partial class MongoDBDatabaseGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static MongoDBDatabaseGetResults DeserializeMongoDBDatabaseGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional resource = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = MongoDBDatabaseGetPropertiesResource.DeserializeMongoDBDatabaseGetPropertiesResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = OptionsResource.DeserializeOptionsResource(property0.Value); + continue; + } + } + continue; + } + } + return new MongoDBDatabaseGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.cs new file mode 100644 index 000000000000..db5f8ef902d3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.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.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB MongoDB database. + public partial class MongoDBDatabaseGetResults : ARMResourceProperties + { + /// Initializes a new instance of MongoDBDatabaseGetResults. + public MongoDBDatabaseGetResults() + { + } + + /// Initializes a new instance of MongoDBDatabaseGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// . + /// Cosmos DB options resource object. + internal MongoDBDatabaseGetResults(string id, string name, string type, string location, IDictionary tags, MongoDBDatabaseGetPropertiesResource resource, OptionsResource options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + public MongoDBDatabaseGetPropertiesResource Resource { get; set; } + /// Cosmos DB options resource object. + public OptionsResource Options { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.Serialization.cs new file mode 100644 index 000000000000..5df0977b871d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MongoDBDatabaseListResult + { + internal static MongoDBDatabaseListResult DeserializeMongoDBDatabaseListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MongoDBDatabaseGetResults.DeserializeMongoDBDatabaseGetResults(item)); + } + value = array; + continue; + } + } + return new MongoDBDatabaseListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.cs new file mode 100644 index 000000000000..0e7dcb546995 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the MongoDB databases and their properties. + public partial class MongoDBDatabaseListResult + { + /// Initializes a new instance of MongoDBDatabaseListResult. + internal MongoDBDatabaseListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of MongoDBDatabaseListResult. + /// List of MongoDB databases and their properties. + internal MongoDBDatabaseListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of MongoDB databases and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResource.Serialization.cs new file mode 100644 index 000000000000..1dbd0c68b7b2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResource.Serialization.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MongoDBDatabaseResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WriteEndObject(); + } + + internal static MongoDBDatabaseResource DeserializeMongoDBDatabaseResource(JsonElement element) + { + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new MongoDBDatabaseResource(id); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResource.cs new file mode 100644 index 000000000000..bb33443e6a77 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB MongoDB database resource object. + public partial class MongoDBDatabaseResource + { + /// Initializes a new instance of MongoDBDatabaseResource. + /// Name of the Cosmos DB MongoDB database. + /// is null. + public MongoDBDatabaseResource(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + } + + /// Name of the Cosmos DB MongoDB database. + public string Id { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndex.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndex.Serialization.cs new file mode 100644 index 000000000000..56d7e436645d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndex.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MongoIndex : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"); + writer.WriteObjectValue(Key); + } + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } + writer.WriteEndObject(); + } + + internal static MongoIndex DeserializeMongoIndex(JsonElement element) + { + Optional key = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key")) + { + key = MongoIndexKeys.DeserializeMongoIndexKeys(property.Value); + continue; + } + if (property.NameEquals("options")) + { + options = MongoIndexOptions.DeserializeMongoIndexOptions(property.Value); + continue; + } + } + return new MongoIndex(key.Value, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndex.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndex.cs new file mode 100644 index 000000000000..7e30f6172424 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndex.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB MongoDB collection index key. + public partial class MongoIndex + { + /// Initializes a new instance of MongoIndex. + public MongoIndex() + { + } + + /// Initializes a new instance of MongoIndex. + /// Cosmos DB MongoDB collection index keys. + /// Cosmos DB MongoDB collection index key options. + internal MongoIndex(MongoIndexKeys key, MongoIndexOptions options) + { + Key = key; + Options = options; + } + + /// Cosmos DB MongoDB collection index keys. + public MongoIndexKeys Key { get; set; } + /// Cosmos DB MongoDB collection index key options. + public MongoIndexOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.Serialization.cs new file mode 100644 index 000000000000..c98c11416ac6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MongoIndexKeys : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Keys)) + { + writer.WritePropertyName("keys"); + writer.WriteStartArray(); + foreach (var item in Keys) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static MongoIndexKeys DeserializeMongoIndexKeys(JsonElement element) + { + Optional> keys = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keys")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + keys = array; + continue; + } + } + return new MongoIndexKeys(Optional.ToList(keys)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.cs new file mode 100644 index 000000000000..d46f6ad9cc56 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB MongoDB collection resource object. + public partial class MongoIndexKeys + { + /// Initializes a new instance of MongoIndexKeys. + public MongoIndexKeys() + { + Keys = new ChangeTrackingList(); + } + + /// Initializes a new instance of MongoIndexKeys. + /// List of keys for each MongoDB collection in the Azure Cosmos DB service. + internal MongoIndexKeys(IList keys) + { + Keys = keys; + } + + /// List of keys for each MongoDB collection in the Azure Cosmos DB service. + public IList Keys { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexOptions.Serialization.cs new file mode 100644 index 000000000000..53ae556c40ad --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexOptions.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class MongoIndexOptions : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ExpireAfterSeconds)) + { + writer.WritePropertyName("expireAfterSeconds"); + writer.WriteNumberValue(ExpireAfterSeconds.Value); + } + if (Optional.IsDefined(Unique)) + { + writer.WritePropertyName("unique"); + writer.WriteBooleanValue(Unique.Value); + } + writer.WriteEndObject(); + } + + internal static MongoIndexOptions DeserializeMongoIndexOptions(JsonElement element) + { + Optional expireAfterSeconds = default; + Optional unique = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("expireAfterSeconds")) + { + expireAfterSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("unique")) + { + unique = property.Value.GetBoolean(); + continue; + } + } + return new MongoIndexOptions(Optional.ToNullable(expireAfterSeconds), Optional.ToNullable(unique)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexOptions.cs new file mode 100644 index 000000000000..08a3505a6dfb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexOptions.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB MongoDB collection index options. + public partial class MongoIndexOptions + { + /// Initializes a new instance of MongoIndexOptions. + public MongoIndexOptions() + { + } + + /// Initializes a new instance of MongoIndexOptions. + /// Expire after seconds. + /// Is unique or not. + internal MongoIndexOptions(int? expireAfterSeconds, bool? unique) + { + ExpireAfterSeconds = expireAfterSeconds; + Unique = unique; + } + + /// Expire after seconds. + public int? ExpireAfterSeconds { get; set; } + /// Is unique or not. + public bool? Unique { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspace.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspace.Serialization.cs new file mode 100644 index 000000000000..137aa53e110a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspace.Serialization.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class NotebookWorkspace : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static NotebookWorkspace DeserializeNotebookWorkspace(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional notebookServerEndpoint = default; + Optional status = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("notebookServerEndpoint")) + { + notebookServerEndpoint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("status")) + { + status = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new NotebookWorkspace(id.Value, name.Value, type.Value, notebookServerEndpoint.Value, status.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspace.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspace.cs new file mode 100644 index 000000000000..67006c6321b9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspace.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// A notebook workspace resource. + public partial class NotebookWorkspace : ARMProxyResource + { + /// Initializes a new instance of NotebookWorkspace. + public NotebookWorkspace() + { + } + + /// Initializes a new instance of NotebookWorkspace. + /// The unique resource identifier of the database account. + /// The name of the database account. + /// The type of Azure resource. + /// Specifies the endpoint of Notebook server. + /// Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating. + internal NotebookWorkspace(string id, string name, string type, string notebookServerEndpoint, string status) : base(id, name, type) + { + NotebookServerEndpoint = notebookServerEndpoint; + Status = status; + } + + /// Specifies the endpoint of Notebook server. + public string NotebookServerEndpoint { get; } + /// Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating. + public string Status { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceConnectionInfoResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceConnectionInfoResult.Serialization.cs new file mode 100644 index 000000000000..6b602a6c238c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceConnectionInfoResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class NotebookWorkspaceConnectionInfoResult + { + internal static NotebookWorkspaceConnectionInfoResult DeserializeNotebookWorkspaceConnectionInfoResult(JsonElement element) + { + Optional authToken = default; + Optional notebookServerEndpoint = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authToken")) + { + authToken = property.Value.GetString(); + continue; + } + if (property.NameEquals("notebookServerEndpoint")) + { + notebookServerEndpoint = property.Value.GetString(); + continue; + } + } + return new NotebookWorkspaceConnectionInfoResult(authToken.Value, notebookServerEndpoint.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceConnectionInfoResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceConnectionInfoResult.cs new file mode 100644 index 000000000000..c5ba1e92cb8c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceConnectionInfoResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The connection info for the given notebook workspace. + public partial class NotebookWorkspaceConnectionInfoResult + { + /// Initializes a new instance of NotebookWorkspaceConnectionInfoResult. + internal NotebookWorkspaceConnectionInfoResult() + { + } + + /// Initializes a new instance of NotebookWorkspaceConnectionInfoResult. + /// Specifies auth token used for connecting to Notebook server (uses token-based auth). + /// Specifies the endpoint of Notebook server. + internal NotebookWorkspaceConnectionInfoResult(string authToken, string notebookServerEndpoint) + { + AuthToken = authToken; + NotebookServerEndpoint = notebookServerEndpoint; + } + + /// Specifies auth token used for connecting to Notebook server (uses token-based auth). + public string AuthToken { get; } + /// Specifies the endpoint of Notebook server. + public string NotebookServerEndpoint { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..a93408114ea2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceCreateUpdateParameters.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class NotebookWorkspaceCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static NotebookWorkspaceCreateUpdateParameters DeserializeNotebookWorkspaceCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new NotebookWorkspaceCreateUpdateParameters(id.Value, name.Value, type.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceCreateUpdateParameters.cs new file mode 100644 index 000000000000..5a0bb976f5c0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceCreateUpdateParameters.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create a notebook workspace resource. + public partial class NotebookWorkspaceCreateUpdateParameters : ARMProxyResource + { + /// Initializes a new instance of NotebookWorkspaceCreateUpdateParameters. + public NotebookWorkspaceCreateUpdateParameters() + { + } + + /// Initializes a new instance of NotebookWorkspaceCreateUpdateParameters. + /// The unique resource identifier of the database account. + /// The name of the database account. + /// The type of Azure resource. + internal NotebookWorkspaceCreateUpdateParameters(string id, string name, string type) : base(id, name, type) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceListResult.Serialization.cs new file mode 100644 index 000000000000..98d10e1523bc --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class NotebookWorkspaceListResult + { + internal static NotebookWorkspaceListResult DeserializeNotebookWorkspaceListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NotebookWorkspace.DeserializeNotebookWorkspace(item)); + } + value = array; + continue; + } + } + return new NotebookWorkspaceListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceListResult.cs new file mode 100644 index 000000000000..3c98edd78c59 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// A list of notebook workspace resources. + public partial class NotebookWorkspaceListResult + { + /// Initializes a new instance of NotebookWorkspaceListResult. + internal NotebookWorkspaceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NotebookWorkspaceListResult. + /// Array of notebook workspace resources. + internal NotebookWorkspaceListResult(IReadOnlyList value) + { + Value = value; + } + + /// Array of notebook workspace resources. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceName.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceName.cs new file mode 100644 index 000000000000..1a8ce965994e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NotebookWorkspaceName.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The NotebookWorkspaceName. + public readonly partial struct NotebookWorkspaceName : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public NotebookWorkspaceName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "default"; + + /// default. + public static NotebookWorkspaceName Default { get; } = new NotebookWorkspaceName(DefaultValue); + /// Determines if two values are the same. + public static bool operator ==(NotebookWorkspaceName left, NotebookWorkspaceName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NotebookWorkspaceName left, NotebookWorkspaceName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NotebookWorkspaceName(string value) => new NotebookWorkspaceName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NotebookWorkspaceName other && Equals(other); + /// + public bool Equals(NotebookWorkspaceName 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Operation.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Operation.Serialization.cs new file mode 100644 index 000000000000..b859bd41708e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Operation.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class Operation + { + internal static Operation DeserializeOperation(JsonElement element) + { + Optional name = default; + Optional display = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("display")) + { + display = OperationDisplay.DeserializeOperationDisplay(property.Value); + continue; + } + } + return new Operation(name.Value, display.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Operation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..72e22bacf1de --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/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.ResourceManager.CosmosDB.Models +{ + /// REST API 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationDisplay.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationDisplay.Serialization.cs new file mode 100644 index 000000000000..5900955ea0c0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationDisplay.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class OperationDisplay + { + internal static OperationDisplay DeserializeOperationDisplay(JsonElement element) + { + Optional provider = default; + Optional resource = default; + Optional operation = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("Provider")) + { + provider = property.Value.GetString(); + continue; + } + if (property.NameEquals("Resource")) + { + resource = property.Value.GetString(); + continue; + } + if (property.NameEquals("Operation")) + { + operation = property.Value.GetString(); + continue; + } + if (property.NameEquals("Description")) + { + description = property.Value.GetString(); + continue; + } + } + return new OperationDisplay(provider.Value, resource.Value, operation.Value, description.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationDisplay.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..08b496c03676 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/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.ResourceManager.CosmosDB.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.ResourceProvider. + /// Resource on which the operation is performed: Profile, endpoint, etc. + /// Operation type: Read, write, delete, etc. + /// Description of operation. + internal OperationDisplay(string provider, string resource, string operation, string description) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + } + + /// Service provider: Microsoft.ResourceProvider. + 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 operation. + public string Description { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationListResult.Serialization.cs new file mode 100644 index 000000000000..ad498c99f8f8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationListResult.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class OperationListResult + { + internal static OperationListResult DeserializeOperationListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Operation.DeserializeOperation(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new OperationListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationListResult.cs new file mode 100644 index 000000000000..fc21b76ef9b4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Result of the request to list Resource Provider 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() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of OperationListResult. + /// List of operations supported by the Resource Provider. + /// 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 operations supported by the Resource Provider. + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OptionsResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OptionsResource.Serialization.cs new file mode 100644 index 000000000000..0a42952f2bcb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OptionsResource.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class OptionsResource + { + internal static OptionsResource DeserializeOptionsResource(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); + continue; + } + } + return new OptionsResource(Optional.ToNullable(throughput), autoscaleSettings.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OptionsResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OptionsResource.cs new file mode 100644 index 000000000000..3d76dfa1f573 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OptionsResource.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB options resource object. + public partial class OptionsResource + { + /// Initializes a new instance of OptionsResource. + internal OptionsResource() + { + } + + /// Initializes a new instance of OptionsResource. + /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. + /// Specifies the Autoscale settings. + internal OptionsResource(int? throughput, AutoscaleSettings autoscaleSettings) + { + Throughput = throughput; + AutoscaleSettings = autoscaleSettings; + } + + /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. + public int? Throughput { get; } + /// Specifies the Autoscale settings. + public AutoscaleSettings AutoscaleSettings { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionKind.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionKind.cs new file mode 100644 index 000000000000..7b7f428085d0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionKind.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Indicates the kind of algorithm used for partitioning. + public readonly partial struct PartitionKind : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public PartitionKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string HashValue = "Hash"; + private const string RangeValue = "Range"; + + /// Hash. + public static PartitionKind Hash { get; } = new PartitionKind(HashValue); + /// Range. + public static PartitionKind Range { get; } = new PartitionKind(RangeValue); + /// Determines if two values are the same. + public static bool operator ==(PartitionKind left, PartitionKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PartitionKind left, PartitionKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PartitionKind(string value) => new PartitionKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PartitionKind other && Equals(other); + /// + public bool Equals(PartitionKind 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.Serialization.cs new file mode 100644 index 000000000000..7f345726bcf9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.Serialization.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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PartitionMetric + { + internal static PartitionMetric DeserializePartitionMetric(JsonElement element) + { + Optional partitionId = default; + Optional partitionKeyRangeId = default; + Optional startTime = default; + Optional endTime = default; + Optional timeGrain = default; + Optional unit = default; + Optional name = default; + Optional> metricValues = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("partitionId")) + { + partitionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("partitionKeyRangeId")) + { + partitionKeyRangeId = property.Value.GetString(); + continue; + } + if (property.NameEquals("startTime")) + { + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime")) + { + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("timeGrain")) + { + timeGrain = property.Value.GetString(); + continue; + } + if (property.NameEquals("unit")) + { + unit = new UnitType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = MetricName.DeserializeMetricName(property.Value); + continue; + } + if (property.NameEquals("metricValues")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MetricValue.DeserializeMetricValue(item)); + } + metricValues = array; + continue; + } + } + return new PartitionMetric(Optional.ToNullable(startTime), Optional.ToNullable(endTime), timeGrain.Value, Optional.ToNullable(unit), name.Value, Optional.ToList(metricValues), partitionId.Value, partitionKeyRangeId.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.cs new file mode 100644 index 000000000000..95f06c586728 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The metric values for a single partition. + public partial class PartitionMetric : Metric + { + /// Initializes a new instance of PartitionMetric. + internal PartitionMetric() + { + } + + /// Initializes a new instance of PartitionMetric. + /// The start time for the metric (ISO-8601 format). + /// The end time for the metric (ISO-8601 format). + /// The time grain to be used to summarize the metric values. + /// The unit of the metric. + /// The name information for the metric. + /// The metric values for the specified time window and timestep. + /// The partition id (GUID identifier) of the metric values. + /// The partition key range id (integer identifier) of the metric values. + internal PartitionMetric(DateTimeOffset? startTime, DateTimeOffset? endTime, string timeGrain, UnitType? unit, MetricName name, IReadOnlyList metricValues, string partitionId, string partitionKeyRangeId) : base(startTime, endTime, timeGrain, unit, name, metricValues) + { + PartitionId = partitionId; + PartitionKeyRangeId = partitionKeyRangeId; + } + + /// The partition id (GUID identifier) of the metric values. + public string PartitionId { get; } + /// The partition key range id (integer identifier) of the metric values. + public string PartitionKeyRangeId { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.Serialization.cs new file mode 100644 index 000000000000..db4c4cdd6f5f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PartitionMetricListResult + { + internal static PartitionMetricListResult DeserializePartitionMetricListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PartitionMetric.DeserializePartitionMetric(item)); + } + value = array; + continue; + } + } + return new PartitionMetricListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.cs new file mode 100644 index 000000000000..3436193c2f17 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The response to a list partition metrics request. + public partial class PartitionMetricListResult + { + /// Initializes a new instance of PartitionMetricListResult. + internal PartitionMetricListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PartitionMetricListResult. + /// The list of partition-level metrics for the account. + internal PartitionMetricListResult(IReadOnlyList value) + { + Value = value; + } + + /// The list of partition-level metrics for the account. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.Serialization.cs new file mode 100644 index 000000000000..1c2598314884 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.Serialization.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PartitionUsage + { + internal static PartitionUsage DeserializePartitionUsage(JsonElement element) + { + Optional partitionId = default; + Optional partitionKeyRangeId = default; + Optional unit = default; + Optional name = default; + Optional quotaPeriod = default; + Optional limit = default; + Optional currentValue = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("partitionId")) + { + partitionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("partitionKeyRangeId")) + { + partitionKeyRangeId = property.Value.GetString(); + continue; + } + if (property.NameEquals("unit")) + { + unit = new UnitType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = MetricName.DeserializeMetricName(property.Value); + continue; + } + if (property.NameEquals("quotaPeriod")) + { + quotaPeriod = property.Value.GetString(); + continue; + } + if (property.NameEquals("limit")) + { + limit = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("currentValue")) + { + currentValue = property.Value.GetInt64(); + continue; + } + } + return new PartitionUsage(Optional.ToNullable(unit), name.Value, quotaPeriod.Value, Optional.ToNullable(limit), Optional.ToNullable(currentValue), partitionId.Value, partitionKeyRangeId.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.cs new file mode 100644 index 000000000000..b7c49e4cb25b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The partition level usage data for a usage request. + public partial class PartitionUsage : Usage + { + /// Initializes a new instance of PartitionUsage. + internal PartitionUsage() + { + } + + /// Initializes a new instance of PartitionUsage. + /// The unit of the metric. + /// The name information for the metric. + /// The quota period used to summarize the usage values. + /// Maximum value for this metric. + /// Current value for this metric. + /// The partition id (GUID identifier) of the usages. + /// The partition key range id (integer identifier) of the usages. + internal PartitionUsage(UnitType? unit, MetricName name, string quotaPeriod, long? limit, long? currentValue, string partitionId, string partitionKeyRangeId) : base(unit, name, quotaPeriod, limit, currentValue) + { + PartitionId = partitionId; + PartitionKeyRangeId = partitionKeyRangeId; + } + + /// The partition id (GUID identifier) of the usages. + public string PartitionId { get; } + /// The partition key range id (integer identifier) of the usages. + public string PartitionKeyRangeId { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.Serialization.cs new file mode 100644 index 000000000000..e39cb1a6bad8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PartitionUsagesResult + { + internal static PartitionUsagesResult DeserializePartitionUsagesResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PartitionUsage.DeserializePartitionUsage(item)); + } + value = array; + continue; + } + } + return new PartitionUsagesResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.cs new file mode 100644 index 000000000000..9e901fcdef51 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The response to a list partition level usage request. + public partial class PartitionUsagesResult + { + /// Initializes a new instance of PartitionUsagesResult. + internal PartitionUsagesResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PartitionUsagesResult. + /// The list of partition-level usages for the database. A usage is a point in time metric. + internal PartitionUsagesResult(IReadOnlyList value) + { + Value = value; + } + + /// The list of partition-level usages for the database. A usage is a point in time metric. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetric.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetric.Serialization.cs new file mode 100644 index 000000000000..596385296e0c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetric.Serialization.cs @@ -0,0 +1,66 @@ +// 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.ResourceManager.CosmosDB.Models +{ + public partial class PercentileMetric + { + internal static PercentileMetric DeserializePercentileMetric(JsonElement element) + { + Optional startTime = default; + Optional endTime = default; + Optional timeGrain = default; + Optional unit = default; + Optional name = default; + Optional> metricValues = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("startTime")) + { + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime")) + { + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("timeGrain")) + { + timeGrain = property.Value.GetString(); + continue; + } + if (property.NameEquals("unit")) + { + unit = new UnitType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = MetricName.DeserializeMetricName(property.Value); + continue; + } + if (property.NameEquals("metricValues")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PercentileMetricValue.DeserializePercentileMetricValue(item)); + } + metricValues = array; + continue; + } + } + return new PercentileMetric(Optional.ToNullable(startTime), Optional.ToNullable(endTime), timeGrain.Value, Optional.ToNullable(unit), name.Value, Optional.ToList(metricValues)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetric.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetric.cs new file mode 100644 index 000000000000..c562aec2312d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetric.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Percentile Metric data. + public partial class PercentileMetric + { + /// Initializes a new instance of PercentileMetric. + internal PercentileMetric() + { + MetricValues = new ChangeTrackingList(); + } + + /// Initializes a new instance of PercentileMetric. + /// The start time for the metric (ISO-8601 format). + /// The end time for the metric (ISO-8601 format). + /// The time grain to be used to summarize the metric values. + /// The unit of the metric. + /// The name information for the metric. + /// The percentile metric values for the specified time window and timestep. + internal PercentileMetric(DateTimeOffset? startTime, DateTimeOffset? endTime, string timeGrain, UnitType? unit, MetricName name, IReadOnlyList metricValues) + { + StartTime = startTime; + EndTime = endTime; + TimeGrain = timeGrain; + Unit = unit; + Name = name; + MetricValues = metricValues; + } + + /// The start time for the metric (ISO-8601 format). + public DateTimeOffset? StartTime { get; } + /// The end time for the metric (ISO-8601 format). + public DateTimeOffset? EndTime { get; } + /// The time grain to be used to summarize the metric values. + public string TimeGrain { get; } + /// The unit of the metric. + public UnitType? Unit { get; } + /// The name information for the metric. + public MetricName Name { get; } + /// The percentile metric values for the specified time window and timestep. + public IReadOnlyList MetricValues { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.Serialization.cs new file mode 100644 index 000000000000..74f16d1e0f09 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PercentileMetricListResult + { + internal static PercentileMetricListResult DeserializePercentileMetricListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PercentileMetric.DeserializePercentileMetric(item)); + } + value = array; + continue; + } + } + return new PercentileMetricListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.cs new file mode 100644 index 000000000000..405a5aa8dcb5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The response to a list percentile metrics request. + public partial class PercentileMetricListResult + { + /// Initializes a new instance of PercentileMetricListResult. + internal PercentileMetricListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PercentileMetricListResult. + /// The list of percentile metrics for the account. + internal PercentileMetricListResult(IReadOnlyList value) + { + Value = value; + } + + /// The list of percentile metrics for the account. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.Serialization.cs new file mode 100644 index 000000000000..0b1e999d1cce --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.Serialization.cs @@ -0,0 +1,102 @@ +// 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.ResourceManager.CosmosDB.Models +{ + public partial class PercentileMetricValue + { + internal static PercentileMetricValue DeserializePercentileMetricValue(JsonElement element) + { + Optional p10 = default; + Optional p25 = default; + Optional p50 = default; + Optional p75 = default; + Optional p90 = default; + Optional p95 = default; + Optional p99 = default; + Optional Count = default; + Optional average = default; + Optional maximum = default; + Optional minimum = default; + Optional timestamp = default; + Optional total = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("P10")) + { + p10 = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("P25")) + { + p25 = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("P50")) + { + p50 = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("P75")) + { + p75 = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("P90")) + { + p90 = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("P95")) + { + p95 = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("P99")) + { + p99 = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("_count")) + { + Count = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("average")) + { + average = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("maximum")) + { + maximum = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("minimum")) + { + minimum = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("timestamp")) + { + timestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("total")) + { + total = property.Value.GetDouble(); + continue; + } + } + return new PercentileMetricValue(Optional.ToNullable(Count), Optional.ToNullable(average), Optional.ToNullable(maximum), Optional.ToNullable(minimum), Optional.ToNullable(timestamp), Optional.ToNullable(total), Optional.ToNullable(p10), Optional.ToNullable(p25), Optional.ToNullable(p50), Optional.ToNullable(p75), Optional.ToNullable(p90), Optional.ToNullable(p95), Optional.ToNullable(p99)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.cs new file mode 100644 index 000000000000..9d4a15bb9540 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Represents percentile metrics values. + public partial class PercentileMetricValue : MetricValue + { + /// Initializes a new instance of PercentileMetricValue. + internal PercentileMetricValue() + { + } + + /// Initializes a new instance of PercentileMetricValue. + /// The number of values for the metric. + /// The average value of the metric. + /// The max value of the metric. + /// The min value of the metric. + /// The metric timestamp (ISO-8601 format). + /// The total value of the metric. + /// The 10th percentile value for the metric. + /// The 25th percentile value for the metric. + /// The 50th percentile value for the metric. + /// The 75th percentile value for the metric. + /// The 90th percentile value for the metric. + /// The 95th percentile value for the metric. + /// The 99th percentile value for the metric. + internal PercentileMetricValue(int? count, double? average, double? maximum, double? minimum, DateTimeOffset? timestamp, double? total, double? p10, double? p25, double? p50, double? p75, double? p90, double? p95, double? p99) : base(count, average, maximum, minimum, timestamp, total) + { + P10 = p10; + P25 = p25; + P50 = p50; + P75 = p75; + P90 = p90; + P95 = p95; + P99 = p99; + } + + /// The 10th percentile value for the metric. + public double? P10 { get; } + /// The 25th percentile value for the metric. + public double? P25 { get; } + /// The 50th percentile value for the metric. + public double? P50 { get; } + /// The 75th percentile value for the metric. + public double? P75 { get; } + /// The 90th percentile value for the metric. + public double? P90 { get; } + /// The 95th percentile value for the metric. + public double? P95 { get; } + /// The 99th percentile value for the metric. + public double? P99 { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrimaryAggregationType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrimaryAggregationType.cs new file mode 100644 index 000000000000..fb0a2eff33be --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrimaryAggregationType.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The primary aggregation type of the metric. + public readonly partial struct PrimaryAggregationType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public PrimaryAggregationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string AverageValue = "Average"; + private const string TotalValue = "Total"; + private const string MinimumValue = "Minimum"; + private const string MaximumValue = "Maximum"; + private const string LastValue = "Last"; + + /// None. + public static PrimaryAggregationType None { get; } = new PrimaryAggregationType(NoneValue); + /// Average. + public static PrimaryAggregationType Average { get; } = new PrimaryAggregationType(AverageValue); + /// Total. + public static PrimaryAggregationType Total { get; } = new PrimaryAggregationType(TotalValue); + /// Minimum. + public static PrimaryAggregationType Minimum { get; } = new PrimaryAggregationType(MinimumValue); + /// Maximum. + public static PrimaryAggregationType Maximum { get; } = new PrimaryAggregationType(MaximumValue); + /// Last. + public static PrimaryAggregationType Last { get; } = new PrimaryAggregationType(LastValue); + /// Determines if two values are the same. + public static bool operator ==(PrimaryAggregationType left, PrimaryAggregationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PrimaryAggregationType left, PrimaryAggregationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PrimaryAggregationType(string value) => new PrimaryAggregationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PrimaryAggregationType other && Equals(other); + /// + public bool Equals(PrimaryAggregationType 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.Serialization.cs new file mode 100644 index 000000000000..cdac7ede36a3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.Serialization.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PrivateEndpointConnection : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(PrivateEndpoint)) + { + writer.WritePropertyName("privateEndpoint"); + writer.WriteObjectValue(PrivateEndpoint); + } + if (Optional.IsDefined(PrivateLinkServiceConnectionState)) + { + writer.WritePropertyName("privateLinkServiceConnectionState"); + writer.WriteObjectValue(PrivateLinkServiceConnectionState); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PrivateEndpointConnection DeserializePrivateEndpointConnection(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional privateEndpoint = default; + Optional privateLinkServiceConnectionState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("privateEndpoint")) + { + privateEndpoint = PrivateEndpointProperty.DeserializePrivateEndpointProperty(property0.Value); + continue; + } + if (property0.NameEquals("privateLinkServiceConnectionState")) + { + privateLinkServiceConnectionState = PrivateLinkServiceConnectionStateProperty.DeserializePrivateLinkServiceConnectionStateProperty(property0.Value); + continue; + } + } + continue; + } + } + return new PrivateEndpointConnection(id.Value, name.Value, type.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 000000000000..4eadb2696512 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// A private endpoint connection. + public partial class PrivateEndpointConnection : Resource + { + /// Initializes a new instance of PrivateEndpointConnection. + public PrivateEndpointConnection() + { + } + + /// Initializes a new instance of PrivateEndpointConnection. + /// Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + /// Private endpoint which the connection belongs to. + /// Connection State of the Private Endpoint Connection. + internal PrivateEndpointConnection(string id, string name, string type, PrivateEndpointProperty privateEndpoint, PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) : base(id, name, type) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + } + + /// Private endpoint which the connection belongs to. + public PrivateEndpointProperty PrivateEndpoint { get; set; } + /// Connection State of the Private Endpoint Connection. + public PrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionAutoGenerated.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionAutoGenerated.Serialization.cs new file mode 100644 index 000000000000..7a54a7df4a70 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionAutoGenerated.Serialization.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PrivateEndpointConnectionAutoGenerated : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(PrivateEndpoint)) + { + writer.WritePropertyName("privateEndpoint"); + writer.WriteObjectValue(PrivateEndpoint); + } + if (Optional.IsDefined(PrivateLinkServiceConnectionState)) + { + writer.WritePropertyName("privateLinkServiceConnectionState"); + writer.WriteObjectValue(PrivateLinkServiceConnectionState); + } + if (Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"); + writer.WriteStringValue(GroupId); + } + if (Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"); + writer.WriteStringValue(ProvisioningState); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PrivateEndpointConnectionAutoGenerated DeserializePrivateEndpointConnectionAutoGenerated(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional privateEndpoint = default; + Optional privateLinkServiceConnectionState = default; + Optional groupId = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("privateEndpoint")) + { + privateEndpoint = PrivateEndpointProperty.DeserializePrivateEndpointProperty(property0.Value); + continue; + } + if (property0.NameEquals("privateLinkServiceConnectionState")) + { + privateLinkServiceConnectionState = PrivateLinkServiceConnectionStatePropertyAutoGenerated.DeserializePrivateLinkServiceConnectionStatePropertyAutoGenerated(property0.Value); + continue; + } + if (property0.NameEquals("groupId")) + { + groupId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("provisioningState")) + { + provisioningState = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new PrivateEndpointConnectionAutoGenerated(id.Value, name.Value, type.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, groupId.Value, provisioningState.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionAutoGenerated.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionAutoGenerated.cs new file mode 100644 index 000000000000..ea1cf960c64a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionAutoGenerated.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// A private endpoint connection. + public partial class PrivateEndpointConnectionAutoGenerated : Resource + { + /// Initializes a new instance of PrivateEndpointConnectionAutoGenerated. + public PrivateEndpointConnectionAutoGenerated() + { + } + + /// Initializes a new instance of PrivateEndpointConnectionAutoGenerated. + /// Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + /// Private endpoint which the connection belongs to. + /// Connection State of the Private Endpoint Connection. + /// Group id of the private endpoint. + /// Provisioning state of the private endpoint. + internal PrivateEndpointConnectionAutoGenerated(string id, string name, string type, PrivateEndpointProperty privateEndpoint, PrivateLinkServiceConnectionStatePropertyAutoGenerated privateLinkServiceConnectionState, string groupId, string provisioningState) : base(id, name, type) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + GroupId = groupId; + ProvisioningState = provisioningState; + } + + /// Private endpoint which the connection belongs to. + public PrivateEndpointProperty PrivateEndpoint { get; set; } + /// Connection State of the Private Endpoint Connection. + public PrivateLinkServiceConnectionStatePropertyAutoGenerated PrivateLinkServiceConnectionState { get; set; } + /// Group id of the private endpoint. + public string GroupId { get; set; } + /// Provisioning state of the private endpoint. + public string ProvisioningState { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.Serialization.cs new file mode 100644 index 000000000000..b7df6e08136e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PrivateEndpointConnectionListResult + { + internal static PrivateEndpointConnectionListResult DeserializePrivateEndpointConnectionListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PrivateEndpointConnectionAutoGenerated.DeserializePrivateEndpointConnectionAutoGenerated(item)); + } + value = array; + continue; + } + } + return new PrivateEndpointConnectionListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.cs new file mode 100644 index 000000000000..da057443907b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// A list of private endpoint connections. + public partial class PrivateEndpointConnectionListResult + { + /// Initializes a new instance of PrivateEndpointConnectionListResult. + internal PrivateEndpointConnectionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PrivateEndpointConnectionListResult. + /// Array of private endpoint connections. + internal PrivateEndpointConnectionListResult(IReadOnlyList value) + { + Value = value; + } + + /// Array of private endpoint connections. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.Serialization.cs new file mode 100644 index 000000000000..819d9323c3b9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PrivateEndpointProperty : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + writer.WriteEndObject(); + } + + internal static PrivateEndpointProperty DeserializePrivateEndpointProperty(JsonElement element) + { + Optional id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new PrivateEndpointProperty(id.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.cs new file mode 100644 index 000000000000..274e55b9a740 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Private endpoint which the connection belongs to. + public partial class PrivateEndpointProperty + { + /// Initializes a new instance of PrivateEndpointProperty. + public PrivateEndpointProperty() + { + } + + /// Initializes a new instance of PrivateEndpointProperty. + /// Resource id of the private endpoint. + internal PrivateEndpointProperty(string id) + { + Id = id; + } + + /// Resource id of the private endpoint. + public string Id { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkResource.Serialization.cs new file mode 100644 index 000000000000..c27551331f05 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkResource.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.ResourceManager.CosmosDB.Models +{ + public partial class PrivateLinkResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PrivateLinkResource DeserializePrivateLinkResource(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional groupId = default; + Optional> requiredMembers = default; + Optional> requiredZoneNames = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("groupId")) + { + groupId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("requiredMembers")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredMembers = array; + continue; + } + if (property0.NameEquals("requiredZoneNames")) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredZoneNames = array; + continue; + } + } + continue; + } + } + return new PrivateLinkResource(id.Value, name.Value, type.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 000000000000..80d67d1ca55b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkResource.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// A private link resource. + public partial class PrivateLinkResource : ARMProxyResource + { + /// Initializes a new instance of PrivateLinkResource. + public PrivateLinkResource() + { + RequiredMembers = new ChangeTrackingList(); + RequiredZoneNames = new ChangeTrackingList(); + } + + /// Initializes a new instance of PrivateLinkResource. + /// The unique resource identifier of the database account. + /// The name of the database account. + /// The type of Azure resource. + /// The private link resource group id. + /// The private link resource required member names. + /// The private link resource required zone names. + internal PrivateLinkResource(string id, string name, string type, string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames) : base(id, name, type) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + } + + /// The private link resource group id. + public string GroupId { get; } + /// The private link resource required member names. + public IReadOnlyList RequiredMembers { get; } + /// The private link resource required zone names. + public IReadOnlyList RequiredZoneNames { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkResourceListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkResourceListResult.Serialization.cs new file mode 100644 index 000000000000..c94207ecb672 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkResourceListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PrivateLinkResourceListResult + { + internal static PrivateLinkResourceListResult DeserializePrivateLinkResourceListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PrivateLinkResource.DeserializePrivateLinkResource(item)); + } + value = array; + continue; + } + } + return new PrivateLinkResourceListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkResourceListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkResourceListResult.cs new file mode 100644 index 000000000000..4e1c91f4116e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkResourceListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// A list of private link resources. + public partial class PrivateLinkResourceListResult + { + /// Initializes a new instance of PrivateLinkResourceListResult. + internal PrivateLinkResourceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PrivateLinkResourceListResult. + /// Array of private link resources. + internal PrivateLinkResourceListResult(IReadOnlyList value) + { + Value = value; + } + + /// Array of private link resources. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.Serialization.cs new file mode 100644 index 000000000000..4ba4d384e5bd --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PrivateLinkServiceConnectionStateProperty : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"); + writer.WriteStringValue(Status); + } + writer.WriteEndObject(); + } + + internal static PrivateLinkServiceConnectionStateProperty DeserializePrivateLinkServiceConnectionStateProperty(JsonElement element) + { + Optional status = default; + Optional actionsRequired = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status")) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("actionsRequired")) + { + actionsRequired = property.Value.GetString(); + continue; + } + } + return new PrivateLinkServiceConnectionStateProperty(status.Value, actionsRequired.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs new file mode 100644 index 000000000000..fa6662ae6f3d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Connection State of the Private Endpoint Connection. + public partial class PrivateLinkServiceConnectionStateProperty + { + /// Initializes a new instance of PrivateLinkServiceConnectionStateProperty. + public PrivateLinkServiceConnectionStateProperty() + { + } + + /// Initializes a new instance of PrivateLinkServiceConnectionStateProperty. + /// The private link service connection status. + /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). + internal PrivateLinkServiceConnectionStateProperty(string status, string actionsRequired) + { + Status = status; + ActionsRequired = actionsRequired; + } + + /// The private link service connection status. + public string Status { get; set; } + /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). + public string ActionsRequired { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.Serialization.cs new file mode 100644 index 000000000000..72fff8588b4a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.Serialization.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PrivateLinkServiceConnectionStatePropertyAutoGenerated : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"); + writer.WriteStringValue(Status); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + + internal static PrivateLinkServiceConnectionStatePropertyAutoGenerated DeserializePrivateLinkServiceConnectionStatePropertyAutoGenerated(JsonElement element) + { + Optional status = default; + Optional description = default; + Optional actionsRequired = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status")) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("description")) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("actionsRequired")) + { + actionsRequired = property.Value.GetString(); + continue; + } + } + return new PrivateLinkServiceConnectionStatePropertyAutoGenerated(status.Value, description.Value, actionsRequired.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.cs new file mode 100644 index 000000000000..bec93e5e28d1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Connection State of the Private Endpoint Connection. + public partial class PrivateLinkServiceConnectionStatePropertyAutoGenerated + { + /// Initializes a new instance of PrivateLinkServiceConnectionStatePropertyAutoGenerated. + public PrivateLinkServiceConnectionStatePropertyAutoGenerated() + { + } + + /// Initializes a new instance of PrivateLinkServiceConnectionStatePropertyAutoGenerated. + /// The private link service connection status. + /// The private link service connection description. + /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). + internal PrivateLinkServiceConnectionStatePropertyAutoGenerated(string status, string description, string actionsRequired) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + } + + /// The private link service connection status. + public string Status { get; set; } + /// The private link service connection description. + public string Description { get; set; } + /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). + public string ActionsRequired { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ProxyResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ProxyResource.Serialization.cs new file mode 100644 index 000000000000..76805fcaf1ab --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ProxyResource.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ProxyResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static ProxyResource DeserializeProxyResource(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new ProxyResource(id.Value, name.Value, type.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ProxyResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..a26a3e3cde89 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + public partial class ProxyResource : Resource + { + /// Initializes a new instance of ProxyResource. + public ProxyResource() + { + } + + /// Initializes a new instance of ProxyResource. + /// Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + internal ProxyResource(string id, string name, string type) : base(id, name, type) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PublicNetworkAccess.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 000000000000..d2b78186d079 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PublicNetworkAccess.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Whether requests from Public Network are allowed. + public readonly partial struct PublicNetworkAccess : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public PublicNetworkAccess(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static PublicNetworkAccess Enabled { get; } = new PublicNetworkAccess(EnabledValue); + /// Disabled. + public static PublicNetworkAccess Disabled { get; } = new PublicNetworkAccess(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(PublicNetworkAccess left, PublicNetworkAccess right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PublicNetworkAccess left, PublicNetworkAccess right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PublicNetworkAccess(string value) => new PublicNetworkAccess(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PublicNetworkAccess other && Equals(other); + /// + public bool Equals(PublicNetworkAccess 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.Serialization.cs new file mode 100644 index 000000000000..afaae4a88368 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.Serialization.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RegionForOnlineOffline : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("region"); + writer.WriteStringValue(Region); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.cs new file mode 100644 index 000000000000..c1148411aba5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB region to online or offline. + public partial class RegionForOnlineOffline + { + /// Initializes a new instance of RegionForOnlineOffline. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// is null. + public RegionForOnlineOffline(string region) + { + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + + Region = region; + } + + /// Cosmos DB region, with spaces between words and each word capitalized. + public string Region { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Resource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Resource.Serialization.cs new file mode 100644 index 000000000000..882d6ecda3c8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Resource.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class Resource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static Resource DeserializeResource(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new Resource(id.Value, name.Value, type.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Resource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..51c36262af05 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Resource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The Resource. + public partial class Resource + { + /// Initializes a new instance of Resource. + public Resource() + { + } + + /// Initializes a new instance of Resource. + /// Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + internal Resource(string id, string name, string type) + { + Id = id; + Name = name; + Type = type; + } + + /// Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + public string Id { get; } + /// The name of the resource. + public string Name { get; } + /// The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + public string Type { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServerVersion.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServerVersion.cs new file mode 100644 index 000000000000..0b5e9b20f8c7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServerVersion.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Describes the ServerVersion of an a MongoDB account. + public readonly partial struct ServerVersion : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ServerVersion(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string Three2Value = "3.2"; + private const string Three6Value = "3.6"; + + /// 3.2. + public static ServerVersion Three2 { get; } = new ServerVersion(Three2Value); + /// 3.6. + public static ServerVersion Three6 { get; } = new ServerVersion(Three6Value); + /// Determines if two values are the same. + public static bool operator ==(ServerVersion left, ServerVersion right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ServerVersion left, ServerVersion right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ServerVersion(string value) => new ServerVersion(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ServerVersion other && Equals(other); + /// + public bool Equals(ServerVersion 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.Serialization.cs new file mode 100644 index 000000000000..910b0b6ebfe5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SpatialSpec : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"); + writer.WriteStringValue(Path); + } + if (Optional.IsCollectionDefined(Types)) + { + writer.WritePropertyName("types"); + writer.WriteStartArray(); + foreach (var item in Types) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static SpatialSpec DeserializeSpatialSpec(JsonElement element) + { + Optional path = default; + Optional> types = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("path")) + { + path = property.Value.GetString(); + continue; + } + if (property.NameEquals("types")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new SpatialType(item.GetString())); + } + types = array; + continue; + } + } + return new SpatialSpec(path.Value, Optional.ToList(types)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.cs new file mode 100644 index 000000000000..8a35fcceaeb0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The SpatialSpec. + public partial class SpatialSpec + { + /// Initializes a new instance of SpatialSpec. + public SpatialSpec() + { + Types = new ChangeTrackingList(); + } + + /// Initializes a new instance of SpatialSpec. + /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + /// List of path's spatial type. + internal SpatialSpec(string path, IList types) + { + Path = path; + Types = types; + } + + /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + public string Path { get; set; } + /// List of path's spatial type. + public IList Types { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialType.cs new file mode 100644 index 000000000000..b6c24f5f9fba --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Indicates the spatial type of index. + public readonly partial struct SpatialType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public SpatialType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PointValue = "Point"; + private const string LineStringValue = "LineString"; + private const string PolygonValue = "Polygon"; + private const string MultiPolygonValue = "MultiPolygon"; + + /// Point. + public static SpatialType Point { get; } = new SpatialType(PointValue); + /// LineString. + public static SpatialType LineString { get; } = new SpatialType(LineStringValue); + /// Polygon. + public static SpatialType Polygon { get; } = new SpatialType(PolygonValue); + /// MultiPolygon. + public static SpatialType MultiPolygon { get; } = new SpatialType(MultiPolygonValue); + /// Determines if two values are the same. + public static bool operator ==(SpatialType left, SpatialType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SpatialType left, SpatialType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SpatialType(string value) => new SpatialType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SpatialType other && Equals(other); + /// + public bool Equals(SpatialType 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..a0b6cca977b0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.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.ResourceManager.CosmosDB.Models +{ + public partial class SqlContainerCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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("resource"); + writer.WriteObjectValue(Resource); + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SqlContainerCreateUpdateParameters DeserializeSqlContainerCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + SqlContainerResource resource = default; + CreateUpdateOptions options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = SqlContainerResource.DeserializeSqlContainerResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new SqlContainerCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.cs new file mode 100644 index 000000000000..f9c940b37c21 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB container. + public partial class SqlContainerCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of SqlContainerCreateUpdateParameters. + /// The standard JSON format of a container. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + /// or is null. + public SqlContainerCreateUpdateParameters(SqlContainerResource resource, CreateUpdateOptions options) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + Resource = resource; + Options = options; + } + + /// Initializes a new instance of SqlContainerCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The standard JSON format of a container. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal SqlContainerCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, SqlContainerResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a container. + public SqlContainerResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesOptions.Serialization.cs new file mode 100644 index 000000000000..20d2fc39ebd2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesOptions.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlContainerGetPropertiesOptions + { + internal static SqlContainerGetPropertiesOptions DeserializeSqlContainerGetPropertiesOptions(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); + continue; + } + } + return new SqlContainerGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesOptions.cs new file mode 100644 index 000000000000..cd9bed1d32a3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesOptions.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The SqlContainerGetPropertiesOptions. + public partial class SqlContainerGetPropertiesOptions : OptionsResource + { + /// Initializes a new instance of SqlContainerGetPropertiesOptions. + internal SqlContainerGetPropertiesOptions() + { + } + + /// Initializes a new instance of SqlContainerGetPropertiesOptions. + /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. + /// Specifies the Autoscale settings. + internal SqlContainerGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..352858c6ce22 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.Serialization.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlContainerGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsDefined(IndexingPolicy)) + { + writer.WritePropertyName("indexingPolicy"); + writer.WriteObjectValue(IndexingPolicy); + } + if (Optional.IsDefined(PartitionKey)) + { + writer.WritePropertyName("partitionKey"); + writer.WriteObjectValue(PartitionKey); + } + if (Optional.IsDefined(DefaultTtl)) + { + writer.WritePropertyName("defaultTtl"); + writer.WriteNumberValue(DefaultTtl.Value); + } + if (Optional.IsDefined(UniqueKeyPolicy)) + { + writer.WritePropertyName("uniqueKeyPolicy"); + writer.WriteObjectValue(UniqueKeyPolicy); + } + if (Optional.IsDefined(ConflictResolutionPolicy)) + { + writer.WritePropertyName("conflictResolutionPolicy"); + writer.WriteObjectValue(ConflictResolutionPolicy); + } + if (Optional.IsDefined(AnalyticalStorageTtl)) + { + writer.WritePropertyName("analyticalStorageTtl"); + writer.WriteNumberValue(AnalyticalStorageTtl.Value); + } + writer.WriteEndObject(); + } + + internal static SqlContainerGetPropertiesResource DeserializeSqlContainerGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + Optional indexingPolicy = default; + Optional partitionKey = default; + Optional defaultTtl = default; + Optional uniqueKeyPolicy = default; + Optional conflictResolutionPolicy = default; + Optional analyticalStorageTtl = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("indexingPolicy")) + { + indexingPolicy = IndexingPolicy.DeserializeIndexingPolicy(property.Value); + continue; + } + if (property.NameEquals("partitionKey")) + { + partitionKey = ContainerPartitionKey.DeserializeContainerPartitionKey(property.Value); + continue; + } + if (property.NameEquals("defaultTtl")) + { + defaultTtl = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("uniqueKeyPolicy")) + { + uniqueKeyPolicy = UniqueKeyPolicy.DeserializeUniqueKeyPolicy(property.Value); + continue; + } + if (property.NameEquals("conflictResolutionPolicy")) + { + conflictResolutionPolicy = ConflictResolutionPolicy.DeserializeConflictResolutionPolicy(property.Value); + continue; + } + if (property.NameEquals("analyticalStorageTtl")) + { + analyticalStorageTtl = property.Value.GetInt64(); + continue; + } + } + return new SqlContainerGetPropertiesResource(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.cs new file mode 100644 index 000000000000..a47d848ef5b5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The SqlContainerGetPropertiesResource. + public partial class SqlContainerGetPropertiesResource : SqlContainerResource + { + /// Initializes a new instance of SqlContainerGetPropertiesResource. + /// Name of the Cosmos DB SQL container. + /// is null. + public SqlContainerGetPropertiesResource(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of SqlContainerGetPropertiesResource. + /// Name of the Cosmos DB SQL container. + /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. + /// The configuration of the partition key to be used for partitioning data into multiple partitions. + /// Default time to live. + /// The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + /// The conflict resolution policy for the container. + /// Analytical TTL. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + internal SqlContainerGetPropertiesResource(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int? defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, long? analyticalStorageTtl, string rid, object ts, string etag) : base(id, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy, analyticalStorageTtl) + { + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.Serialization.cs new file mode 100644 index 000000000000..f7a2cc4af9bd --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.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.ResourceManager.CosmosDB.Models +{ + public partial class SqlContainerGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SqlContainerGetResults DeserializeSqlContainerGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional resource = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = SqlContainerGetPropertiesResource.DeserializeSqlContainerGetPropertiesResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = OptionsResource.DeserializeOptionsResource(property0.Value); + continue; + } + } + continue; + } + } + return new SqlContainerGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.cs new file mode 100644 index 000000000000..f147b5729107 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.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.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB container. + public partial class SqlContainerGetResults : ARMResourceProperties + { + /// Initializes a new instance of SqlContainerGetResults. + public SqlContainerGetResults() + { + } + + /// Initializes a new instance of SqlContainerGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// . + /// Cosmos DB options resource object. + internal SqlContainerGetResults(string id, string name, string type, string location, IDictionary tags, SqlContainerGetPropertiesResource resource, OptionsResource options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + public SqlContainerGetPropertiesResource Resource { get; set; } + /// Cosmos DB options resource object. + public OptionsResource Options { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerListResult.Serialization.cs new file mode 100644 index 000000000000..0cbbc0f50748 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlContainerListResult + { + internal static SqlContainerListResult DeserializeSqlContainerListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SqlContainerGetResults.DeserializeSqlContainerGetResults(item)); + } + value = array; + continue; + } + } + return new SqlContainerListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerListResult.cs new file mode 100644 index 000000000000..8c003e819a9c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the containers and their properties. + public partial class SqlContainerListResult + { + /// Initializes a new instance of SqlContainerListResult. + internal SqlContainerListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SqlContainerListResult. + /// List of containers and their properties. + internal SqlContainerListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of containers and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerResource.Serialization.cs new file mode 100644 index 000000000000..ee5ab280be34 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerResource.Serialization.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlContainerResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsDefined(IndexingPolicy)) + { + writer.WritePropertyName("indexingPolicy"); + writer.WriteObjectValue(IndexingPolicy); + } + if (Optional.IsDefined(PartitionKey)) + { + writer.WritePropertyName("partitionKey"); + writer.WriteObjectValue(PartitionKey); + } + if (Optional.IsDefined(DefaultTtl)) + { + writer.WritePropertyName("defaultTtl"); + writer.WriteNumberValue(DefaultTtl.Value); + } + if (Optional.IsDefined(UniqueKeyPolicy)) + { + writer.WritePropertyName("uniqueKeyPolicy"); + writer.WriteObjectValue(UniqueKeyPolicy); + } + if (Optional.IsDefined(ConflictResolutionPolicy)) + { + writer.WritePropertyName("conflictResolutionPolicy"); + writer.WriteObjectValue(ConflictResolutionPolicy); + } + if (Optional.IsDefined(AnalyticalStorageTtl)) + { + writer.WritePropertyName("analyticalStorageTtl"); + writer.WriteNumberValue(AnalyticalStorageTtl.Value); + } + writer.WriteEndObject(); + } + + internal static SqlContainerResource DeserializeSqlContainerResource(JsonElement element) + { + string id = default; + Optional indexingPolicy = default; + Optional partitionKey = default; + Optional defaultTtl = default; + Optional uniqueKeyPolicy = default; + Optional conflictResolutionPolicy = default; + Optional analyticalStorageTtl = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("indexingPolicy")) + { + indexingPolicy = IndexingPolicy.DeserializeIndexingPolicy(property.Value); + continue; + } + if (property.NameEquals("partitionKey")) + { + partitionKey = ContainerPartitionKey.DeserializeContainerPartitionKey(property.Value); + continue; + } + if (property.NameEquals("defaultTtl")) + { + defaultTtl = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("uniqueKeyPolicy")) + { + uniqueKeyPolicy = UniqueKeyPolicy.DeserializeUniqueKeyPolicy(property.Value); + continue; + } + if (property.NameEquals("conflictResolutionPolicy")) + { + conflictResolutionPolicy = ConflictResolutionPolicy.DeserializeConflictResolutionPolicy(property.Value); + continue; + } + if (property.NameEquals("analyticalStorageTtl")) + { + analyticalStorageTtl = property.Value.GetInt64(); + continue; + } + } + return new SqlContainerResource(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Optional.ToNullable(analyticalStorageTtl)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerResource.cs new file mode 100644 index 000000000000..032885d4cdfe --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerResource.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB SQL container resource object. + public partial class SqlContainerResource + { + /// Initializes a new instance of SqlContainerResource. + /// Name of the Cosmos DB SQL container. + /// is null. + public SqlContainerResource(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + } + + /// Initializes a new instance of SqlContainerResource. + /// Name of the Cosmos DB SQL container. + /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. + /// The configuration of the partition key to be used for partitioning data into multiple partitions. + /// Default time to live. + /// The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + /// The conflict resolution policy for the container. + /// Analytical TTL. + internal SqlContainerResource(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int? defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, long? analyticalStorageTtl) + { + Id = id; + IndexingPolicy = indexingPolicy; + PartitionKey = partitionKey; + DefaultTtl = defaultTtl; + UniqueKeyPolicy = uniqueKeyPolicy; + ConflictResolutionPolicy = conflictResolutionPolicy; + AnalyticalStorageTtl = analyticalStorageTtl; + } + + /// Name of the Cosmos DB SQL container. + public string Id { get; set; } + /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. + public IndexingPolicy IndexingPolicy { get; set; } + /// The configuration of the partition key to be used for partitioning data into multiple partitions. + public ContainerPartitionKey PartitionKey { get; set; } + /// Default time to live. + public int? DefaultTtl { get; set; } + /// The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + /// The conflict resolution policy for the container. + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + /// Analytical TTL. + public long? AnalyticalStorageTtl { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..e5b32e585f4c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.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.ResourceManager.CosmosDB.Models +{ + public partial class SqlDatabaseCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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("resource"); + writer.WriteObjectValue(Resource); + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SqlDatabaseCreateUpdateParameters DeserializeSqlDatabaseCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + SqlDatabaseResource resource = default; + CreateUpdateOptions options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = SqlDatabaseResource.DeserializeSqlDatabaseResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new SqlDatabaseCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.cs new file mode 100644 index 000000000000..4e3ab0cf193f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB SQL database. + public partial class SqlDatabaseCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of SqlDatabaseCreateUpdateParameters. + /// The standard JSON format of a SQL database. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + /// or is null. + public SqlDatabaseCreateUpdateParameters(SqlDatabaseResource resource, CreateUpdateOptions options) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + Resource = resource; + Options = options; + } + + /// Initializes a new instance of SqlDatabaseCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The standard JSON format of a SQL database. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal SqlDatabaseCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, SqlDatabaseResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a SQL database. + public SqlDatabaseResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesOptions.Serialization.cs new file mode 100644 index 000000000000..2f6de962a3ac --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesOptions.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlDatabaseGetPropertiesOptions + { + internal static SqlDatabaseGetPropertiesOptions DeserializeSqlDatabaseGetPropertiesOptions(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); + continue; + } + } + return new SqlDatabaseGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesOptions.cs new file mode 100644 index 000000000000..4340cd59ce99 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesOptions.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The SqlDatabaseGetPropertiesOptions. + public partial class SqlDatabaseGetPropertiesOptions : OptionsResource + { + /// Initializes a new instance of SqlDatabaseGetPropertiesOptions. + internal SqlDatabaseGetPropertiesOptions() + { + } + + /// Initializes a new instance of SqlDatabaseGetPropertiesOptions. + /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. + /// Specifies the Autoscale settings. + internal SqlDatabaseGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..55f0653f341b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.Serialization.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlDatabaseGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Colls)) + { + writer.WritePropertyName("_colls"); + writer.WriteStringValue(Colls); + } + if (Optional.IsDefined(Users)) + { + writer.WritePropertyName("_users"); + writer.WriteStringValue(Users); + } + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WriteEndObject(); + } + + internal static SqlDatabaseGetPropertiesResource DeserializeSqlDatabaseGetPropertiesResource(JsonElement element) + { + Optional Colls = default; + Optional Users = default; + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_colls")) + { + Colls = property.Value.GetString(); + continue; + } + if (property.NameEquals("_users")) + { + Users = property.Value.GetString(); + continue; + } + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new SqlDatabaseGetPropertiesResource(id, Colls.Value, Users.Value, Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.cs new file mode 100644 index 000000000000..b3e9b506aa92 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The SqlDatabaseGetPropertiesResource. + public partial class SqlDatabaseGetPropertiesResource : SqlDatabaseResource + { + /// Initializes a new instance of SqlDatabaseGetPropertiesResource. + /// Name of the Cosmos DB SQL database. + /// is null. + public SqlDatabaseGetPropertiesResource(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of SqlDatabaseGetPropertiesResource. + /// Name of the Cosmos DB SQL database. + /// A system generated property that specified the addressable path of the collections resource. + /// A system generated property that specifies the addressable path of the users resource. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + /// is null. + internal SqlDatabaseGetPropertiesResource(string id, string colls, string users, string rid, object ts, string etag) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Colls = colls; + Users = users; + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property that specified the addressable path of the collections resource. + public string Colls { get; set; } + /// A system generated property that specifies the addressable path of the users resource. + public string Users { get; set; } + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.Serialization.cs new file mode 100644 index 000000000000..55bec7ba67fc --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.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.ResourceManager.CosmosDB.Models +{ + public partial class SqlDatabaseGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SqlDatabaseGetResults DeserializeSqlDatabaseGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional resource = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = SqlDatabaseGetPropertiesResource.DeserializeSqlDatabaseGetPropertiesResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = OptionsResource.DeserializeOptionsResource(property0.Value); + continue; + } + } + continue; + } + } + return new SqlDatabaseGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.cs new file mode 100644 index 000000000000..6cd20208c94c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.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.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB SQL database. + public partial class SqlDatabaseGetResults : ARMResourceProperties + { + /// Initializes a new instance of SqlDatabaseGetResults. + public SqlDatabaseGetResults() + { + } + + /// Initializes a new instance of SqlDatabaseGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// . + /// Cosmos DB options resource object. + internal SqlDatabaseGetResults(string id, string name, string type, string location, IDictionary tags, SqlDatabaseGetPropertiesResource resource, OptionsResource options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + public SqlDatabaseGetPropertiesResource Resource { get; set; } + /// Cosmos DB options resource object. + public OptionsResource Options { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseListResult.Serialization.cs new file mode 100644 index 000000000000..5f5d93155db8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlDatabaseListResult + { + internal static SqlDatabaseListResult DeserializeSqlDatabaseListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SqlDatabaseGetResults.DeserializeSqlDatabaseGetResults(item)); + } + value = array; + continue; + } + } + return new SqlDatabaseListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseListResult.cs new file mode 100644 index 000000000000..8b68ebacacf3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the SQL databases and their properties. + public partial class SqlDatabaseListResult + { + /// Initializes a new instance of SqlDatabaseListResult. + internal SqlDatabaseListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SqlDatabaseListResult. + /// List of SQL databases and their properties. + internal SqlDatabaseListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of SQL databases and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseResource.Serialization.cs new file mode 100644 index 000000000000..5a33076115d3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseResource.Serialization.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlDatabaseResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WriteEndObject(); + } + + internal static SqlDatabaseResource DeserializeSqlDatabaseResource(JsonElement element) + { + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new SqlDatabaseResource(id); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseResource.cs new file mode 100644 index 000000000000..03033f173eff --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseResource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB SQL database resource object. + public partial class SqlDatabaseResource + { + /// Initializes a new instance of SqlDatabaseResource. + /// Name of the Cosmos DB SQL database. + /// is null. + public SqlDatabaseResource(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + } + + /// Name of the Cosmos DB SQL database. + public string Id { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..0987df43f5e6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.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.ResourceManager.CosmosDB.Models +{ + public partial class SqlStoredProcedureCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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("resource"); + writer.WriteObjectValue(Resource); + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SqlStoredProcedureCreateUpdateParameters DeserializeSqlStoredProcedureCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + SqlStoredProcedureResource resource = default; + CreateUpdateOptions options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = SqlStoredProcedureResource.DeserializeSqlStoredProcedureResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new SqlStoredProcedureCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.cs new file mode 100644 index 000000000000..09f606c7e1f6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB storedProcedure. + public partial class SqlStoredProcedureCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of SqlStoredProcedureCreateUpdateParameters. + /// The standard JSON format of a storedProcedure. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + /// or is null. + public SqlStoredProcedureCreateUpdateParameters(SqlStoredProcedureResource resource, CreateUpdateOptions options) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + Resource = resource; + Options = options; + } + + /// Initializes a new instance of SqlStoredProcedureCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The standard JSON format of a storedProcedure. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal SqlStoredProcedureCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, SqlStoredProcedureResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a storedProcedure. + public SqlStoredProcedureResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..bbf456cdd755 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.Serialization.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlStoredProcedureGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsDefined(Body)) + { + writer.WritePropertyName("body"); + writer.WriteStringValue(Body); + } + writer.WriteEndObject(); + } + + internal static SqlStoredProcedureGetPropertiesResource DeserializeSqlStoredProcedureGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + Optional body = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("body")) + { + body = property.Value.GetString(); + continue; + } + } + return new SqlStoredProcedureGetPropertiesResource(id, body.Value, Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.cs new file mode 100644 index 000000000000..edba2b95b369 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The SqlStoredProcedureGetPropertiesResource. + public partial class SqlStoredProcedureGetPropertiesResource : SqlStoredProcedureResource + { + /// Initializes a new instance of SqlStoredProcedureGetPropertiesResource. + /// Name of the Cosmos DB SQL storedProcedure. + /// is null. + public SqlStoredProcedureGetPropertiesResource(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of SqlStoredProcedureGetPropertiesResource. + /// Name of the Cosmos DB SQL storedProcedure. + /// Body of the Stored Procedure. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + internal SqlStoredProcedureGetPropertiesResource(string id, string body, string rid, object ts, string etag) : base(id, body) + { + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.Serialization.cs new file mode 100644 index 000000000000..f0bab138fad8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.Serialization.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlStoredProcedureGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SqlStoredProcedureGetResults DeserializeSqlStoredProcedureGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional resource = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = SqlStoredProcedureGetPropertiesResource.DeserializeSqlStoredProcedureGetPropertiesResource(property0.Value); + continue; + } + } + continue; + } + } + return new SqlStoredProcedureGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.cs new file mode 100644 index 000000000000..61d1404494b8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.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.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB storedProcedure. + public partial class SqlStoredProcedureGetResults : ARMResourceProperties + { + /// Initializes a new instance of SqlStoredProcedureGetResults. + public SqlStoredProcedureGetResults() + { + } + + /// Initializes a new instance of SqlStoredProcedureGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// . + internal SqlStoredProcedureGetResults(string id, string name, string type, string location, IDictionary tags, SqlStoredProcedureGetPropertiesResource resource) : base(id, name, type, location, tags) + { + Resource = resource; + } + + public SqlStoredProcedureGetPropertiesResource Resource { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureListResult.Serialization.cs new file mode 100644 index 000000000000..a738d8f7e575 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlStoredProcedureListResult + { + internal static SqlStoredProcedureListResult DeserializeSqlStoredProcedureListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SqlStoredProcedureGetResults.DeserializeSqlStoredProcedureGetResults(item)); + } + value = array; + continue; + } + } + return new SqlStoredProcedureListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureListResult.cs new file mode 100644 index 000000000000..6f6b665ba7aa --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the storedProcedures and their properties. + public partial class SqlStoredProcedureListResult + { + /// Initializes a new instance of SqlStoredProcedureListResult. + internal SqlStoredProcedureListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SqlStoredProcedureListResult. + /// List of storedProcedures and their properties. + internal SqlStoredProcedureListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of storedProcedures and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureResource.Serialization.cs new file mode 100644 index 000000000000..9f1fce682b84 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureResource.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlStoredProcedureResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsDefined(Body)) + { + writer.WritePropertyName("body"); + writer.WriteStringValue(Body); + } + writer.WriteEndObject(); + } + + internal static SqlStoredProcedureResource DeserializeSqlStoredProcedureResource(JsonElement element) + { + string id = default; + Optional body = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("body")) + { + body = property.Value.GetString(); + continue; + } + } + return new SqlStoredProcedureResource(id, body.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureResource.cs new file mode 100644 index 000000000000..70c6317e3055 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureResource.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB SQL storedProcedure resource object. + public partial class SqlStoredProcedureResource + { + /// Initializes a new instance of SqlStoredProcedureResource. + /// Name of the Cosmos DB SQL storedProcedure. + /// is null. + public SqlStoredProcedureResource(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + } + + /// Initializes a new instance of SqlStoredProcedureResource. + /// Name of the Cosmos DB SQL storedProcedure. + /// Body of the Stored Procedure. + internal SqlStoredProcedureResource(string id, string body) + { + Id = id; + Body = body; + } + + /// Name of the Cosmos DB SQL storedProcedure. + public string Id { get; set; } + /// Body of the Stored Procedure. + public string Body { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..314986cdad46 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.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.ResourceManager.CosmosDB.Models +{ + public partial class SqlTriggerCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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("resource"); + writer.WriteObjectValue(Resource); + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SqlTriggerCreateUpdateParameters DeserializeSqlTriggerCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + SqlTriggerResource resource = default; + CreateUpdateOptions options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = SqlTriggerResource.DeserializeSqlTriggerResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new SqlTriggerCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.cs new file mode 100644 index 000000000000..42687f4ef18f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB trigger. + public partial class SqlTriggerCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of SqlTriggerCreateUpdateParameters. + /// The standard JSON format of a trigger. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + /// or is null. + public SqlTriggerCreateUpdateParameters(SqlTriggerResource resource, CreateUpdateOptions options) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + Resource = resource; + Options = options; + } + + /// Initializes a new instance of SqlTriggerCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The standard JSON format of a trigger. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal SqlTriggerCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, SqlTriggerResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a trigger. + public SqlTriggerResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..0435fbcd64b4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.Serialization.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlTriggerGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsDefined(Body)) + { + writer.WritePropertyName("body"); + writer.WriteStringValue(Body); + } + if (Optional.IsDefined(TriggerType)) + { + writer.WritePropertyName("triggerType"); + writer.WriteStringValue(TriggerType.Value.ToString()); + } + if (Optional.IsDefined(TriggerOperation)) + { + writer.WritePropertyName("triggerOperation"); + writer.WriteStringValue(TriggerOperation.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static SqlTriggerGetPropertiesResource DeserializeSqlTriggerGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + Optional body = default; + Optional triggerType = default; + Optional triggerOperation = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("body")) + { + body = property.Value.GetString(); + continue; + } + if (property.NameEquals("triggerType")) + { + triggerType = new TriggerType(property.Value.GetString()); + continue; + } + if (property.NameEquals("triggerOperation")) + { + triggerOperation = new TriggerOperation(property.Value.GetString()); + continue; + } + } + return new SqlTriggerGetPropertiesResource(id, body.Value, Optional.ToNullable(triggerType), Optional.ToNullable(triggerOperation), Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.cs new file mode 100644 index 000000000000..ee3385b83fa5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The SqlTriggerGetPropertiesResource. + public partial class SqlTriggerGetPropertiesResource : SqlTriggerResource + { + /// Initializes a new instance of SqlTriggerGetPropertiesResource. + /// Name of the Cosmos DB SQL trigger. + /// is null. + public SqlTriggerGetPropertiesResource(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of SqlTriggerGetPropertiesResource. + /// Name of the Cosmos DB SQL trigger. + /// Body of the Trigger. + /// Type of the Trigger. + /// The operation the trigger is associated with. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + internal SqlTriggerGetPropertiesResource(string id, string body, TriggerType? triggerType, TriggerOperation? triggerOperation, string rid, object ts, string etag) : base(id, body, triggerType, triggerOperation) + { + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.Serialization.cs new file mode 100644 index 000000000000..ad06eba95509 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.Serialization.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlTriggerGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SqlTriggerGetResults DeserializeSqlTriggerGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional resource = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = SqlTriggerGetPropertiesResource.DeserializeSqlTriggerGetPropertiesResource(property0.Value); + continue; + } + } + continue; + } + } + return new SqlTriggerGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.cs new file mode 100644 index 000000000000..cd2d3e688c13 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.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.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB trigger. + public partial class SqlTriggerGetResults : ARMResourceProperties + { + /// Initializes a new instance of SqlTriggerGetResults. + public SqlTriggerGetResults() + { + } + + /// Initializes a new instance of SqlTriggerGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// . + internal SqlTriggerGetResults(string id, string name, string type, string location, IDictionary tags, SqlTriggerGetPropertiesResource resource) : base(id, name, type, location, tags) + { + Resource = resource; + } + + public SqlTriggerGetPropertiesResource Resource { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerListResult.Serialization.cs new file mode 100644 index 000000000000..6d4aef15fd89 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlTriggerListResult + { + internal static SqlTriggerListResult DeserializeSqlTriggerListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SqlTriggerGetResults.DeserializeSqlTriggerGetResults(item)); + } + value = array; + continue; + } + } + return new SqlTriggerListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerListResult.cs new file mode 100644 index 000000000000..3b84f0752167 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the triggers and their properties. + public partial class SqlTriggerListResult + { + /// Initializes a new instance of SqlTriggerListResult. + internal SqlTriggerListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SqlTriggerListResult. + /// List of triggers and their properties. + internal SqlTriggerListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of triggers and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerResource.Serialization.cs new file mode 100644 index 000000000000..d8bcd900fd56 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerResource.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlTriggerResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsDefined(Body)) + { + writer.WritePropertyName("body"); + writer.WriteStringValue(Body); + } + if (Optional.IsDefined(TriggerType)) + { + writer.WritePropertyName("triggerType"); + writer.WriteStringValue(TriggerType.Value.ToString()); + } + if (Optional.IsDefined(TriggerOperation)) + { + writer.WritePropertyName("triggerOperation"); + writer.WriteStringValue(TriggerOperation.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static SqlTriggerResource DeserializeSqlTriggerResource(JsonElement element) + { + string id = default; + Optional body = default; + Optional triggerType = default; + Optional triggerOperation = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("body")) + { + body = property.Value.GetString(); + continue; + } + if (property.NameEquals("triggerType")) + { + triggerType = new TriggerType(property.Value.GetString()); + continue; + } + if (property.NameEquals("triggerOperation")) + { + triggerOperation = new TriggerOperation(property.Value.GetString()); + continue; + } + } + return new SqlTriggerResource(id, body.Value, Optional.ToNullable(triggerType), Optional.ToNullable(triggerOperation)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerResource.cs new file mode 100644 index 000000000000..160d927cac6a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerResource.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB SQL trigger resource object. + public partial class SqlTriggerResource + { + /// Initializes a new instance of SqlTriggerResource. + /// Name of the Cosmos DB SQL trigger. + /// is null. + public SqlTriggerResource(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + } + + /// Initializes a new instance of SqlTriggerResource. + /// Name of the Cosmos DB SQL trigger. + /// Body of the Trigger. + /// Type of the Trigger. + /// The operation the trigger is associated with. + internal SqlTriggerResource(string id, string body, TriggerType? triggerType, TriggerOperation? triggerOperation) + { + Id = id; + Body = body; + TriggerType = triggerType; + TriggerOperation = triggerOperation; + } + + /// Name of the Cosmos DB SQL trigger. + public string Id { get; set; } + /// Body of the Trigger. + public string Body { get; set; } + /// Type of the Trigger. + public TriggerType? TriggerType { get; set; } + /// The operation the trigger is associated with. + public TriggerOperation? TriggerOperation { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..656392fba11b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.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.ResourceManager.CosmosDB.Models +{ + public partial class SqlUserDefinedFunctionCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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("resource"); + writer.WriteObjectValue(Resource); + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SqlUserDefinedFunctionCreateUpdateParameters DeserializeSqlUserDefinedFunctionCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + SqlUserDefinedFunctionResource resource = default; + CreateUpdateOptions options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = SqlUserDefinedFunctionResource.DeserializeSqlUserDefinedFunctionResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new SqlUserDefinedFunctionCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.cs new file mode 100644 index 000000000000..d80a69a5e3f4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB userDefinedFunction. + public partial class SqlUserDefinedFunctionCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of SqlUserDefinedFunctionCreateUpdateParameters. + /// The standard JSON format of a userDefinedFunction. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + /// or is null. + public SqlUserDefinedFunctionCreateUpdateParameters(SqlUserDefinedFunctionResource resource, CreateUpdateOptions options) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + Resource = resource; + Options = options; + } + + /// Initializes a new instance of SqlUserDefinedFunctionCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The standard JSON format of a userDefinedFunction. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal SqlUserDefinedFunctionCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, SqlUserDefinedFunctionResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a userDefinedFunction. + public SqlUserDefinedFunctionResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..7f5efed51ffe --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.Serialization.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlUserDefinedFunctionGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsDefined(Body)) + { + writer.WritePropertyName("body"); + writer.WriteStringValue(Body); + } + writer.WriteEndObject(); + } + + internal static SqlUserDefinedFunctionGetPropertiesResource DeserializeSqlUserDefinedFunctionGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + Optional body = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("body")) + { + body = property.Value.GetString(); + continue; + } + } + return new SqlUserDefinedFunctionGetPropertiesResource(id, body.Value, Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.cs new file mode 100644 index 000000000000..539f936551b6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The SqlUserDefinedFunctionGetPropertiesResource. + public partial class SqlUserDefinedFunctionGetPropertiesResource : SqlUserDefinedFunctionResource + { + /// Initializes a new instance of SqlUserDefinedFunctionGetPropertiesResource. + /// Name of the Cosmos DB SQL userDefinedFunction. + /// is null. + public SqlUserDefinedFunctionGetPropertiesResource(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of SqlUserDefinedFunctionGetPropertiesResource. + /// Name of the Cosmos DB SQL userDefinedFunction. + /// Body of the User Defined Function. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + internal SqlUserDefinedFunctionGetPropertiesResource(string id, string body, string rid, object ts, string etag) : base(id, body) + { + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.Serialization.cs new file mode 100644 index 000000000000..13f30fc76c83 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.Serialization.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlUserDefinedFunctionGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SqlUserDefinedFunctionGetResults DeserializeSqlUserDefinedFunctionGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional resource = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = SqlUserDefinedFunctionGetPropertiesResource.DeserializeSqlUserDefinedFunctionGetPropertiesResource(property0.Value); + continue; + } + } + continue; + } + } + return new SqlUserDefinedFunctionGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.cs new file mode 100644 index 000000000000..d66e3e1ae87e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.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.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB userDefinedFunction. + public partial class SqlUserDefinedFunctionGetResults : ARMResourceProperties + { + /// Initializes a new instance of SqlUserDefinedFunctionGetResults. + public SqlUserDefinedFunctionGetResults() + { + } + + /// Initializes a new instance of SqlUserDefinedFunctionGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// . + internal SqlUserDefinedFunctionGetResults(string id, string name, string type, string location, IDictionary tags, SqlUserDefinedFunctionGetPropertiesResource resource) : base(id, name, type, location, tags) + { + Resource = resource; + } + + public SqlUserDefinedFunctionGetPropertiesResource Resource { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionListResult.Serialization.cs new file mode 100644 index 000000000000..edd4b11234e2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlUserDefinedFunctionListResult + { + internal static SqlUserDefinedFunctionListResult DeserializeSqlUserDefinedFunctionListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SqlUserDefinedFunctionGetResults.DeserializeSqlUserDefinedFunctionGetResults(item)); + } + value = array; + continue; + } + } + return new SqlUserDefinedFunctionListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionListResult.cs new file mode 100644 index 000000000000..b6c24f759010 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the userDefinedFunctions and their properties. + public partial class SqlUserDefinedFunctionListResult + { + /// Initializes a new instance of SqlUserDefinedFunctionListResult. + internal SqlUserDefinedFunctionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SqlUserDefinedFunctionListResult. + /// List of userDefinedFunctions and their properties. + internal SqlUserDefinedFunctionListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of userDefinedFunctions and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionResource.Serialization.cs new file mode 100644 index 000000000000..e88d99449688 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionResource.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlUserDefinedFunctionResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsDefined(Body)) + { + writer.WritePropertyName("body"); + writer.WriteStringValue(Body); + } + writer.WriteEndObject(); + } + + internal static SqlUserDefinedFunctionResource DeserializeSqlUserDefinedFunctionResource(JsonElement element) + { + string id = default; + Optional body = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("body")) + { + body = property.Value.GetString(); + continue; + } + } + return new SqlUserDefinedFunctionResource(id, body.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionResource.cs new file mode 100644 index 000000000000..e01c72673814 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionResource.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB SQL userDefinedFunction resource object. + public partial class SqlUserDefinedFunctionResource + { + /// Initializes a new instance of SqlUserDefinedFunctionResource. + /// Name of the Cosmos DB SQL userDefinedFunction. + /// is null. + public SqlUserDefinedFunctionResource(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + } + + /// Initializes a new instance of SqlUserDefinedFunctionResource. + /// Name of the Cosmos DB SQL userDefinedFunction. + /// Body of the User Defined Function. + internal SqlUserDefinedFunctionResource(string id, string body) + { + Id = id; + Body = body; + } + + /// Name of the Cosmos DB SQL userDefinedFunction. + public string Id { get; set; } + /// Body of the User Defined Function. + public string Body { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..0fb5eb320a5c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.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.ResourceManager.CosmosDB.Models +{ + public partial class TableCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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("resource"); + writer.WriteObjectValue(Resource); + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static TableCreateUpdateParameters DeserializeTableCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + TableResource resource = default; + CreateUpdateOptions options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = TableResource.DeserializeTableResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new TableCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.cs new file mode 100644 index 000000000000..3336a38f9773 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB Table. + public partial class TableCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of TableCreateUpdateParameters. + /// The standard JSON format of a Table. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + /// or is null. + public TableCreateUpdateParameters(TableResource resource, CreateUpdateOptions options) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + Resource = resource; + Options = options; + } + + /// Initializes a new instance of TableCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The standard JSON format of a Table. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal TableCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, TableResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a Table. + public TableResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesOptions.Serialization.cs new file mode 100644 index 000000000000..7439f6ef8b3c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesOptions.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class TableGetPropertiesOptions + { + internal static TableGetPropertiesOptions DeserializeTableGetPropertiesOptions(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); + continue; + } + } + return new TableGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesOptions.cs new file mode 100644 index 000000000000..562e9792a15b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesOptions.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The TableGetPropertiesOptions. + public partial class TableGetPropertiesOptions : OptionsResource + { + /// Initializes a new instance of TableGetPropertiesOptions. + internal TableGetPropertiesOptions() + { + } + + /// Initializes a new instance of TableGetPropertiesOptions. + /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. + /// Specifies the Autoscale settings. + internal TableGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..76d98b983de9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class TableGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WriteEndObject(); + } + + internal static TableGetPropertiesResource DeserializeTableGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new TableGetPropertiesResource(id, Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.cs new file mode 100644 index 000000000000..4c8dd0dbce51 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The TableGetPropertiesResource. + public partial class TableGetPropertiesResource : TableResource + { + /// Initializes a new instance of TableGetPropertiesResource. + /// Name of the Cosmos DB table. + /// is null. + public TableGetPropertiesResource(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of TableGetPropertiesResource. + /// Name of the Cosmos DB table. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + /// is null. + internal TableGetPropertiesResource(string id, string rid, object ts, string etag) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.Serialization.cs new file mode 100644 index 000000000000..03933e391ad1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.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.ResourceManager.CosmosDB.Models +{ + public partial class TableGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static TableGetResults DeserializeTableGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional resource = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = TableGetPropertiesResource.DeserializeTableGetPropertiesResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + options = OptionsResource.DeserializeOptionsResource(property0.Value); + continue; + } + } + continue; + } + } + return new TableGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.cs new file mode 100644 index 000000000000..b446f942de55 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.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.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB Table. + public partial class TableGetResults : ARMResourceProperties + { + /// Initializes a new instance of TableGetResults. + public TableGetResults() + { + } + + /// Initializes a new instance of TableGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// . + /// Cosmos DB options resource object. + internal TableGetResults(string id, string name, string type, string location, IDictionary tags, TableGetPropertiesResource resource, OptionsResource options) : base(id, name, type, location, tags) + { + Resource = resource; + Options = options; + } + + public TableGetPropertiesResource Resource { get; set; } + /// Cosmos DB options resource object. + public OptionsResource Options { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableListResult.Serialization.cs new file mode 100644 index 000000000000..9b906375e078 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableListResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class TableListResult + { + internal static TableListResult DeserializeTableListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TableGetResults.DeserializeTableGetResults(item)); + } + value = array; + continue; + } + } + return new TableListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableListResult.cs new file mode 100644 index 000000000000..5903165d16b5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the Table and their properties. + public partial class TableListResult + { + /// Initializes a new instance of TableListResult. + internal TableListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of TableListResult. + /// List of Table and their properties. + internal TableListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of Table and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableResource.Serialization.cs new file mode 100644 index 000000000000..0891096e0f5e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableResource.Serialization.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class TableResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WriteEndObject(); + } + + internal static TableResource DeserializeTableResource(JsonElement element) + { + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new TableResource(id); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableResource.cs new file mode 100644 index 000000000000..ea0ab06cb9a6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableResource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB table resource object. + public partial class TableResource + { + /// Initializes a new instance of TableResource. + /// Name of the Cosmos DB table. + /// is null. + public TableResource(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + } + + /// Name of the Cosmos DB table. + public string Id { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResource.Serialization.cs new file mode 100644 index 000000000000..efc980bca614 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResource.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ThroughputPolicyResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(IsEnabled)) + { + writer.WritePropertyName("isEnabled"); + writer.WriteBooleanValue(IsEnabled.Value); + } + if (Optional.IsDefined(IncrementPercent)) + { + writer.WritePropertyName("incrementPercent"); + writer.WriteNumberValue(IncrementPercent.Value); + } + writer.WriteEndObject(); + } + + internal static ThroughputPolicyResource DeserializeThroughputPolicyResource(JsonElement element) + { + Optional isEnabled = default; + Optional incrementPercent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("isEnabled")) + { + isEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("incrementPercent")) + { + incrementPercent = property.Value.GetInt32(); + continue; + } + } + return new ThroughputPolicyResource(Optional.ToNullable(isEnabled), Optional.ToNullable(incrementPercent)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResource.cs new file mode 100644 index 000000000000..2ea64e88942d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResource.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB resource throughput policy. + public partial class ThroughputPolicyResource + { + /// Initializes a new instance of ThroughputPolicyResource. + public ThroughputPolicyResource() + { + } + + /// Initializes a new instance of ThroughputPolicyResource. + /// Determines whether the ThroughputPolicy is active or not. + /// Represents the percentage by which throughput can increase every time throughput policy kicks in. + internal ThroughputPolicyResource(bool? isEnabled, int? incrementPercent) + { + IsEnabled = isEnabled; + IncrementPercent = incrementPercent; + } + + /// Determines whether the ThroughputPolicy is active or not. + public bool? IsEnabled { get; set; } + /// Represents the percentage by which throughput can increase every time throughput policy kicks in. + public int? IncrementPercent { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..6e2557f8c7e2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.Serialization.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ThroughputSettingsGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Throughput)) + { + writer.WritePropertyName("throughput"); + writer.WriteNumberValue(Throughput.Value); + } + if (Optional.IsDefined(AutoscaleSettings)) + { + writer.WritePropertyName("autoscaleSettings"); + writer.WriteObjectValue(AutoscaleSettings); + } + writer.WriteEndObject(); + } + + internal static ThroughputSettingsGetPropertiesResource DeserializeThroughputSettingsGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + Optional throughput = default; + Optional autoscaleSettings = default; + Optional minimumThroughput = default; + Optional offerReplacePending = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + Ts = property.Value.GetObject(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("throughput")) + { + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + autoscaleSettings = AutoscaleSettingsResource.DeserializeAutoscaleSettingsResource(property.Value); + continue; + } + if (property.NameEquals("minimumThroughput")) + { + minimumThroughput = property.Value.GetString(); + continue; + } + if (property.NameEquals("offerReplacePending")) + { + offerReplacePending = property.Value.GetString(); + continue; + } + } + return new ThroughputSettingsGetPropertiesResource(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value, Rid.Value, Ts.Value, Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.cs new file mode 100644 index 000000000000..74de1bb0f78a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The ThroughputSettingsGetPropertiesResource. + public partial class ThroughputSettingsGetPropertiesResource : ThroughputSettingsResource + { + /// Initializes a new instance of ThroughputSettingsGetPropertiesResource. + public ThroughputSettingsGetPropertiesResource() + { + } + + /// Initializes a new instance of ThroughputSettingsGetPropertiesResource. + /// Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. + /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. + /// The minimum throughput of the resource. + /// The throughput replace is pending. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + internal ThroughputSettingsGetPropertiesResource(int? throughput, AutoscaleSettingsResource autoscaleSettings, string minimumThroughput, string offerReplacePending, string rid, object ts, string etag) : base(throughput, autoscaleSettings, minimumThroughput, offerReplacePending) + { + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public object Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.Serialization.cs new file mode 100644 index 000000000000..d8a37b6413d7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.Serialization.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ThroughputSettingsGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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 (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ThroughputSettingsGetResults DeserializeThroughputSettingsGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional resource = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = ThroughputSettingsGetPropertiesResource.DeserializeThroughputSettingsGetPropertiesResource(property0.Value); + continue; + } + } + continue; + } + } + return new ThroughputSettingsGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.cs new file mode 100644 index 000000000000..be7338626463 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.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.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB resource throughput. + public partial class ThroughputSettingsGetResults : ARMResourceProperties + { + /// Initializes a new instance of ThroughputSettingsGetResults. + public ThroughputSettingsGetResults() + { + } + + /// Initializes a new instance of ThroughputSettingsGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// . + internal ThroughputSettingsGetResults(string id, string name, string type, string location, IDictionary tags, ThroughputSettingsGetPropertiesResource resource) : base(id, name, type, location, tags) + { + Resource = resource; + } + + public ThroughputSettingsGetPropertiesResource Resource { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResource.Serialization.cs new file mode 100644 index 000000000000..8d97d9da239c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResource.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.ResourceManager.CosmosDB.Models +{ + public partial class ThroughputSettingsResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Throughput)) + { + writer.WritePropertyName("throughput"); + writer.WriteNumberValue(Throughput.Value); + } + if (Optional.IsDefined(AutoscaleSettings)) + { + writer.WritePropertyName("autoscaleSettings"); + writer.WriteObjectValue(AutoscaleSettings); + } + writer.WriteEndObject(); + } + + internal static ThroughputSettingsResource DeserializeThroughputSettingsResource(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + Optional minimumThroughput = default; + Optional offerReplacePending = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + autoscaleSettings = AutoscaleSettingsResource.DeserializeAutoscaleSettingsResource(property.Value); + continue; + } + if (property.NameEquals("minimumThroughput")) + { + minimumThroughput = property.Value.GetString(); + continue; + } + if (property.NameEquals("offerReplacePending")) + { + offerReplacePending = property.Value.GetString(); + continue; + } + } + return new ThroughputSettingsResource(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResource.cs new file mode 100644 index 000000000000..59293a84c9f2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is required, but not both. + public partial class ThroughputSettingsResource + { + /// Initializes a new instance of ThroughputSettingsResource. + public ThroughputSettingsResource() + { + } + + /// Initializes a new instance of ThroughputSettingsResource. + /// Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. + /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. + /// The minimum throughput of the resource. + /// The throughput replace is pending. + internal ThroughputSettingsResource(int? throughput, AutoscaleSettingsResource autoscaleSettings, string minimumThroughput, string offerReplacePending) + { + Throughput = throughput; + AutoscaleSettings = autoscaleSettings; + MinimumThroughput = minimumThroughput; + OfferReplacePending = offerReplacePending; + } + + /// Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. + public int? Throughput { get; set; } + /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. + public AutoscaleSettingsResource AutoscaleSettings { get; set; } + /// The minimum throughput of the resource. + public string MinimumThroughput { get; } + /// The throughput replace is pending. + public string OfferReplacePending { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..adf1b39638b0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.Serialization.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ThroughputSettingsUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + 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("resource"); + writer.WriteObjectValue(Resource); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ThroughputSettingsUpdateParameters DeserializeThroughputSettingsUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + ThroughputSettingsResource resource = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties")) + { + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = ThroughputSettingsResource.DeserializeThroughputSettingsResource(property0.Value); + continue; + } + } + continue; + } + } + return new ThroughputSettingsUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.cs new file mode 100644 index 000000000000..af31fcf6f583 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to update Cosmos DB resource throughput. + public partial class ThroughputSettingsUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of ThroughputSettingsUpdateParameters. + /// The standard JSON format of a resource throughput. + /// is null. + public ThroughputSettingsUpdateParameters(ThroughputSettingsResource resource) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + + Resource = resource; + } + + /// Initializes a new instance of ThroughputSettingsUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The standard JSON format of a resource throughput. + internal ThroughputSettingsUpdateParameters(string id, string name, string type, string location, IDictionary tags, ThroughputSettingsResource resource) : base(id, name, type, location, tags) + { + Resource = resource; + } + + /// The standard JSON format of a resource throughput. + public ThroughputSettingsResource Resource { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TriggerOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TriggerOperation.cs new file mode 100644 index 000000000000..da3d298c2888 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TriggerOperation.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The operation the trigger is associated with. + public readonly partial struct TriggerOperation : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public TriggerOperation(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AllValue = "All"; + private const string CreateValue = "Create"; + private const string UpdateValue = "Update"; + private const string DeleteValue = "Delete"; + private const string ReplaceValue = "Replace"; + + /// All. + public static TriggerOperation All { get; } = new TriggerOperation(AllValue); + /// Create. + public static TriggerOperation Create { get; } = new TriggerOperation(CreateValue); + /// Update. + public static TriggerOperation Update { get; } = new TriggerOperation(UpdateValue); + /// Delete. + public static TriggerOperation Delete { get; } = new TriggerOperation(DeleteValue); + /// Replace. + public static TriggerOperation Replace { get; } = new TriggerOperation(ReplaceValue); + /// Determines if two values are the same. + public static bool operator ==(TriggerOperation left, TriggerOperation right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TriggerOperation left, TriggerOperation right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TriggerOperation(string value) => new TriggerOperation(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TriggerOperation other && Equals(other); + /// + public bool Equals(TriggerOperation 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TriggerType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TriggerType.cs new file mode 100644 index 000000000000..90c58e082723 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TriggerType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Type of the Trigger. + public readonly partial struct TriggerType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public TriggerType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PreValue = "Pre"; + private const string PostValue = "Post"; + + /// Pre. + public static TriggerType Pre { get; } = new TriggerType(PreValue); + /// Post. + public static TriggerType Post { get; } = new TriggerType(PostValue); + /// Determines if two values are the same. + public static bool operator ==(TriggerType left, TriggerType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TriggerType left, TriggerType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TriggerType(string value) => new TriggerType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TriggerType other && Equals(other); + /// + public bool Equals(TriggerType 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UniqueKey.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UniqueKey.Serialization.cs new file mode 100644 index 000000000000..42b4d6097505 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UniqueKey.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class UniqueKey : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Paths)) + { + writer.WritePropertyName("paths"); + writer.WriteStartArray(); + foreach (var item in Paths) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static UniqueKey DeserializeUniqueKey(JsonElement element) + { + Optional> paths = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("paths")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + paths = array; + continue; + } + } + return new UniqueKey(Optional.ToList(paths)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UniqueKey.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UniqueKey.cs new file mode 100644 index 000000000000..5a116b7360e1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UniqueKey.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. + public partial class UniqueKey + { + /// Initializes a new instance of UniqueKey. + public UniqueKey() + { + Paths = new ChangeTrackingList(); + } + + /// Initializes a new instance of UniqueKey. + /// List of paths must be unique for each document in the Azure Cosmos DB service. + internal UniqueKey(IList paths) + { + Paths = paths; + } + + /// List of paths must be unique for each document in the Azure Cosmos DB service. + public IList Paths { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UniqueKeyPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UniqueKeyPolicy.Serialization.cs new file mode 100644 index 000000000000..8a108e45f28a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UniqueKeyPolicy.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class UniqueKeyPolicy : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(UniqueKeys)) + { + writer.WritePropertyName("uniqueKeys"); + writer.WriteStartArray(); + foreach (var item in UniqueKeys) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static UniqueKeyPolicy DeserializeUniqueKeyPolicy(JsonElement element) + { + Optional> uniqueKeys = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uniqueKeys")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(UniqueKey.DeserializeUniqueKey(item)); + } + uniqueKeys = array; + continue; + } + } + return new UniqueKeyPolicy(Optional.ToList(uniqueKeys)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UniqueKeyPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UniqueKeyPolicy.cs new file mode 100644 index 000000000000..177272afdac7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UniqueKeyPolicy.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + public partial class UniqueKeyPolicy + { + /// Initializes a new instance of UniqueKeyPolicy. + public UniqueKeyPolicy() + { + UniqueKeys = new ChangeTrackingList(); + } + + /// Initializes a new instance of UniqueKeyPolicy. + /// List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. + internal UniqueKeyPolicy(IList uniqueKeys) + { + UniqueKeys = uniqueKeys; + } + + /// List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. + public IList UniqueKeys { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnitType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnitType.cs new file mode 100644 index 000000000000..26efc58554c9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnitType.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The unit of the metric. + public readonly partial struct UnitType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public UnitType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CountValue = "Count"; + private const string BytesValue = "Bytes"; + private const string SecondsValue = "Seconds"; + private const string PercentValue = "Percent"; + private const string CountPerSecondValue = "CountPerSecond"; + private const string BytesPerSecondValue = "BytesPerSecond"; + private const string MillisecondsValue = "Milliseconds"; + + /// Count. + public static UnitType Count { get; } = new UnitType(CountValue); + /// Bytes. + public static UnitType Bytes { get; } = new UnitType(BytesValue); + /// Seconds. + public static UnitType Seconds { get; } = new UnitType(SecondsValue); + /// Percent. + public static UnitType Percent { get; } = new UnitType(PercentValue); + /// CountPerSecond. + public static UnitType CountPerSecond { get; } = new UnitType(CountPerSecondValue); + /// BytesPerSecond. + public static UnitType BytesPerSecond { get; } = new UnitType(BytesPerSecondValue); + /// Milliseconds. + public static UnitType Milliseconds { get; } = new UnitType(MillisecondsValue); + /// Determines if two values are the same. + public static bool operator ==(UnitType left, UnitType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(UnitType left, UnitType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator UnitType(string value) => new UnitType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is UnitType other && Equals(other); + /// + public bool Equals(UnitType 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Usage.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Usage.Serialization.cs new file mode 100644 index 000000000000..75ca551b1d80 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Usage.Serialization.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class Usage + { + internal static Usage DeserializeUsage(JsonElement element) + { + Optional unit = default; + Optional name = default; + Optional quotaPeriod = default; + Optional limit = default; + Optional currentValue = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("unit")) + { + unit = new UnitType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = MetricName.DeserializeMetricName(property.Value); + continue; + } + if (property.NameEquals("quotaPeriod")) + { + quotaPeriod = property.Value.GetString(); + continue; + } + if (property.NameEquals("limit")) + { + limit = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("currentValue")) + { + currentValue = property.Value.GetInt64(); + continue; + } + } + return new Usage(Optional.ToNullable(unit), name.Value, quotaPeriod.Value, Optional.ToNullable(limit), Optional.ToNullable(currentValue)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Usage.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Usage.cs new file mode 100644 index 000000000000..16a4adeae291 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Usage.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The usage data for a usage request. + public partial class Usage + { + /// Initializes a new instance of Usage. + internal Usage() + { + } + + /// Initializes a new instance of Usage. + /// The unit of the metric. + /// The name information for the metric. + /// The quota period used to summarize the usage values. + /// Maximum value for this metric. + /// Current value for this metric. + internal Usage(UnitType? unit, MetricName name, string quotaPeriod, long? limit, long? currentValue) + { + Unit = unit; + Name = name; + QuotaPeriod = quotaPeriod; + Limit = limit; + CurrentValue = currentValue; + } + + /// The unit of the metric. + public UnitType? Unit { get; } + /// The name information for the metric. + public MetricName Name { get; } + /// The quota period used to summarize the usage values. + public string QuotaPeriod { get; } + /// Maximum value for this metric. + public long? Limit { get; } + /// Current value for this metric. + public long? CurrentValue { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UsagesResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UsagesResult.Serialization.cs new file mode 100644 index 000000000000..d1558cb734ea --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UsagesResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class UsagesResult + { + internal static UsagesResult DeserializeUsagesResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Usage.DeserializeUsage(item)); + } + value = array; + continue; + } + } + return new UsagesResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UsagesResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UsagesResult.cs new file mode 100644 index 000000000000..8246489312dc --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UsagesResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The response to a list usage request. + public partial class UsagesResult + { + /// Initializes a new instance of UsagesResult. + internal UsagesResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of UsagesResult. + /// The list of usages for the database. A usage is a point in time metric. + internal UsagesResult(IReadOnlyList value) + { + Value = value; + } + + /// The list of usages for the database. A usage is a point in time metric. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/VirtualNetworkRule.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/VirtualNetworkRule.Serialization.cs new file mode 100644 index 000000000000..75b30e6442b7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/VirtualNetworkRule.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class VirtualNetworkRule : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(IgnoreMissingVNetServiceEndpoint)) + { + writer.WritePropertyName("ignoreMissingVNetServiceEndpoint"); + writer.WriteBooleanValue(IgnoreMissingVNetServiceEndpoint.Value); + } + writer.WriteEndObject(); + } + + internal static VirtualNetworkRule DeserializeVirtualNetworkRule(JsonElement element) + { + Optional id = default; + Optional ignoreMissingVNetServiceEndpoint = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("ignoreMissingVNetServiceEndpoint")) + { + ignoreMissingVNetServiceEndpoint = property.Value.GetBoolean(); + continue; + } + } + return new VirtualNetworkRule(id.Value, Optional.ToNullable(ignoreMissingVNetServiceEndpoint)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/VirtualNetworkRule.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/VirtualNetworkRule.cs new file mode 100644 index 000000000000..5c143256645d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/VirtualNetworkRule.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Virtual Network ACL Rule object. + public partial class VirtualNetworkRule + { + /// Initializes a new instance of VirtualNetworkRule. + public VirtualNetworkRule() + { + } + + /// Initializes a new instance of VirtualNetworkRule. + /// Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// Create firewall rule before the virtual network has vnet service endpoint enabled. + internal VirtualNetworkRule(string id, bool? ignoreMissingVNetServiceEndpoint) + { + Id = id; + IgnoreMissingVNetServiceEndpoint = ignoreMissingVNetServiceEndpoint; + } + + /// Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + public string Id { get; set; } + /// Create firewall rule before the virtual network has vnet service endpoint enabled. + public bool? IgnoreMissingVNetServiceEndpoint { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesCreateUpdateMongoDBCollectionOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesCreateUpdateMongoDBCollectionOperation.cs new file mode 100644 index 000000000000..52bb78ac8d1f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesCreateUpdateMongoDBCollectionOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update an Azure Cosmos DB MongoDB Collection. + public partial class MongoDBResourcesCreateUpdateMongoDBCollectionOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal MongoDBResourcesCreateUpdateMongoDBCollectionOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "MongoDBResourcesCreateUpdateMongoDBCollectionOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override MongoDBCollectionGetResults 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); + + MongoDBCollectionGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return MongoDBCollectionGetResults.DeserializeMongoDBCollectionGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return MongoDBCollectionGetResults.DeserializeMongoDBCollectionGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesCreateUpdateMongoDBDatabaseOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesCreateUpdateMongoDBDatabaseOperation.cs new file mode 100644 index 000000000000..dc49967e1170 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesCreateUpdateMongoDBDatabaseOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or updates Azure Cosmos DB MongoDB database. + public partial class MongoDBResourcesCreateUpdateMongoDBDatabaseOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal MongoDBResourcesCreateUpdateMongoDBDatabaseOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "MongoDBResourcesCreateUpdateMongoDBDatabaseOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override MongoDBDatabaseGetResults 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); + + MongoDBDatabaseGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return MongoDBDatabaseGetResults.DeserializeMongoDBDatabaseGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return MongoDBDatabaseGetResults.DeserializeMongoDBDatabaseGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesDeleteMongoDBCollectionOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesDeleteMongoDBCollectionOperation.cs new file mode 100644 index 000000000000..194428773c69 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesDeleteMongoDBCollectionOperation.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.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB MongoDB Collection. + public partial class MongoDBResourcesDeleteMongoDBCollectionOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal MongoDBResourcesDeleteMongoDBCollectionOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "MongoDBResourcesDeleteMongoDBCollectionOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesDeleteMongoDBDatabaseOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesDeleteMongoDBDatabaseOperation.cs new file mode 100644 index 000000000000..b415265a0a46 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesDeleteMongoDBDatabaseOperation.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.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB MongoDB database. + public partial class MongoDBResourcesDeleteMongoDBDatabaseOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal MongoDBResourcesDeleteMongoDBDatabaseOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "MongoDBResourcesDeleteMongoDBDatabaseOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesMigrateMongoDBCollectionToAutoscaleOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesMigrateMongoDBCollectionToAutoscaleOperation.cs new file mode 100644 index 000000000000..b3719c71e324 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesMigrateMongoDBCollectionToAutoscaleOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + public partial class MongoDBResourcesMigrateMongoDBCollectionToAutoscaleOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal MongoDBResourcesMigrateMongoDBCollectionToAutoscaleOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "MongoDBResourcesMigrateMongoDBCollectionToAutoscaleOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesMigrateMongoDBCollectionToManualThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesMigrateMongoDBCollectionToManualThroughputOperation.cs new file mode 100644 index 000000000000..ac179014ddd1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesMigrateMongoDBCollectionToManualThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + public partial class MongoDBResourcesMigrateMongoDBCollectionToManualThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal MongoDBResourcesMigrateMongoDBCollectionToManualThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "MongoDBResourcesMigrateMongoDBCollectionToManualThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleOperation.cs new file mode 100644 index 000000000000..4acea5271a2c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + public partial class MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputOperation.cs new file mode 100644 index 000000000000..c8ac42d816a0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + public partial class MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesOperations.cs new file mode 100644 index 000000000000..8791b8d04288 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesOperations.cs @@ -0,0 +1,1140 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The MongoDBResources service client. + public partial class MongoDBResourcesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal MongoDBResourcesRestOperations RestClient { get; } + /// Initializes a new instance of MongoDBResourcesOperations for mocking. + protected MongoDBResourcesOperations() + { + } + /// Initializes a new instance of MongoDBResourcesOperations. + /// 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 MongoDBResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new MongoDBResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + public virtual async Task> GetMongoDBDatabaseAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.GetMongoDBDatabase"); + scope.Start(); + try + { + return await RestClient.GetMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + public virtual Response GetMongoDBDatabase(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.GetMongoDBDatabase"); + scope.Start(); + try + { + return RestClient.GetMongoDBDatabase(resourceGroupName, accountName, databaseName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + public virtual async Task> GetMongoDBDatabaseThroughputAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.GetMongoDBDatabaseThroughput"); + scope.Start(); + try + { + return await RestClient.GetMongoDBDatabaseThroughputAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + public virtual Response GetMongoDBDatabaseThroughput(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.GetMongoDBDatabaseThroughput"); + scope.Start(); + try + { + return RestClient.GetMongoDBDatabaseThroughput(resourceGroupName, accountName, databaseName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the MongoDB collection under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + public virtual async Task> GetMongoDBCollectionAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.GetMongoDBCollection"); + scope.Start(); + try + { + return await RestClient.GetMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the MongoDB collection under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + public virtual Response GetMongoDBCollection(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.GetMongoDBCollection"); + scope.Start(); + try + { + return RestClient.GetMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + public virtual async Task> GetMongoDBCollectionThroughputAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.GetMongoDBCollectionThroughput"); + scope.Start(); + try + { + return await RestClient.GetMongoDBCollectionThroughputAsync(resourceGroupName, accountName, databaseName, collectionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + public virtual Response GetMongoDBCollectionThroughput(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.GetMongoDBCollectionThroughput"); + scope.Start(); + try + { + return RestClient.GetMongoDBCollectionThroughput(resourceGroupName, accountName, databaseName, collectionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the MongoDB databases under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListMongoDBDatabasesAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.ListMongoDBDatabases"); + scope.Start(); + try + { + var response = await RestClient.ListMongoDBDatabasesAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the MongoDB databases under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListMongoDBDatabases(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.ListMongoDBDatabases"); + scope.Start(); + try + { + var response = RestClient.ListMongoDBDatabases(resourceGroupName, accountName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Lists the MongoDB collection under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListMongoDBCollectionsAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.ListMongoDBCollections"); + scope.Start(); + try + { + var response = await RestClient.ListMongoDBCollectionsAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the MongoDB collection under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListMongoDBCollections(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.ListMongoDBCollections"); + scope.Start(); + try + { + var response = RestClient.ListMongoDBCollections(resourceGroupName, accountName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Create or updates Azure Cosmos DB MongoDB database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the current MongoDB database. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateUpdateMongoDBDatabaseAsync(string resourceGroupName, string accountName, string databaseName, MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (createUpdateMongoDBDatabaseParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateMongoDBDatabaseParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartCreateUpdateMongoDBDatabase"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters, cancellationToken).ConfigureAwait(false); + return new MongoDBResourcesCreateUpdateMongoDBDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateMongoDBDatabaseRequest(resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or updates Azure Cosmos DB MongoDB database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the current MongoDB database. + /// The cancellation token to use. + /// , , , or is null. + public virtual MongoDBResourcesCreateUpdateMongoDBDatabaseOperation StartCreateUpdateMongoDBDatabase(string resourceGroupName, string accountName, string databaseName, MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (createUpdateMongoDBDatabaseParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateMongoDBDatabaseParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartCreateUpdateMongoDBDatabase"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateMongoDBDatabase(resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters, cancellationToken); + return new MongoDBResourcesCreateUpdateMongoDBDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateMongoDBDatabaseRequest(resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB MongoDB database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteMongoDBDatabaseAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartDeleteMongoDBDatabase"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + return new MongoDBResourcesDeleteMongoDBDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteMongoDBDatabaseRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB MongoDB database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual MongoDBResourcesDeleteMongoDBDatabaseOperation StartDeleteMongoDBDatabase(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartDeleteMongoDBDatabase"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteMongoDBDatabase(resourceGroupName, accountName, databaseName, cancellationToken); + return new MongoDBResourcesDeleteMongoDBDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteMongoDBDatabaseRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of the an Azure Cosmos DB MongoDB database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The RUs per second of the parameters to provide for the current MongoDB database. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartUpdateMongoDBDatabaseThroughputAsync(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartUpdateMongoDBDatabaseThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateMongoDBDatabaseThroughputAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters, cancellationToken).ConfigureAwait(false); + return new MongoDBResourcesUpdateMongoDBDatabaseThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateMongoDBDatabaseThroughputRequest(resourceGroupName, accountName, databaseName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of the an Azure Cosmos DB MongoDB database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The RUs per second of the parameters to provide for the current MongoDB database. + /// The cancellation token to use. + /// , , , or is null. + public virtual MongoDBResourcesUpdateMongoDBDatabaseThroughputOperation StartUpdateMongoDBDatabaseThroughput(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartUpdateMongoDBDatabaseThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.UpdateMongoDBDatabaseThroughput(resourceGroupName, accountName, databaseName, updateThroughputParameters, cancellationToken); + return new MongoDBResourcesUpdateMongoDBDatabaseThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateMongoDBDatabaseThroughputRequest(resourceGroupName, accountName, databaseName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartMigrateMongoDBDatabaseToAutoscaleAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartMigrateMongoDBDatabaseToAutoscale"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateMongoDBDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + return new MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateMongoDBDatabaseToAutoscaleRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleOperation StartMigrateMongoDBDatabaseToAutoscale(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartMigrateMongoDBDatabaseToAutoscale"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateMongoDBDatabaseToAutoscale(resourceGroupName, accountName, databaseName, cancellationToken); + return new MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateMongoDBDatabaseToAutoscaleRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartMigrateMongoDBDatabaseToManualThroughputAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartMigrateMongoDBDatabaseToManualThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateMongoDBDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + return new MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateMongoDBDatabaseToManualThroughputRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputOperation StartMigrateMongoDBDatabaseToManualThroughput(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartMigrateMongoDBDatabaseToManualThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateMongoDBDatabaseToManualThroughput(resourceGroupName, accountName, databaseName, cancellationToken); + return new MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateMongoDBDatabaseToManualThroughputRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB MongoDB Collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The parameters to provide for the current MongoDB Collection. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartCreateUpdateMongoDBCollectionAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + if (createUpdateMongoDBCollectionParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateMongoDBCollectionParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartCreateUpdateMongoDBCollection"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters, cancellationToken).ConfigureAwait(false); + return new MongoDBResourcesCreateUpdateMongoDBCollectionOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateMongoDBCollectionRequest(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB MongoDB Collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The parameters to provide for the current MongoDB Collection. + /// The cancellation token to use. + /// , , , , or is null. + public virtual MongoDBResourcesCreateUpdateMongoDBCollectionOperation StartCreateUpdateMongoDBCollection(string resourceGroupName, string accountName, string databaseName, string collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + if (createUpdateMongoDBCollectionParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateMongoDBCollectionParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartCreateUpdateMongoDBCollection"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters, cancellationToken); + return new MongoDBResourcesCreateUpdateMongoDBCollectionOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateMongoDBCollectionRequest(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB MongoDB Collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartDeleteMongoDBCollectionAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartDeleteMongoDBCollection"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName, cancellationToken).ConfigureAwait(false); + return new MongoDBResourcesDeleteMongoDBCollectionOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteMongoDBCollectionRequest(resourceGroupName, accountName, databaseName, collectionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB MongoDB Collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public virtual MongoDBResourcesDeleteMongoDBCollectionOperation StartDeleteMongoDBCollection(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartDeleteMongoDBCollection"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName, cancellationToken); + return new MongoDBResourcesDeleteMongoDBCollectionOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteMongoDBCollectionRequest(resourceGroupName, accountName, databaseName, collectionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update the RUs per second of an Azure Cosmos DB MongoDB collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The RUs per second of the parameters to provide for the current MongoDB collection. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartUpdateMongoDBCollectionThroughputAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartUpdateMongoDBCollectionThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateMongoDBCollectionThroughputAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters, cancellationToken).ConfigureAwait(false); + return new MongoDBResourcesUpdateMongoDBCollectionThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateMongoDBCollectionThroughputRequest(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update the RUs per second of an Azure Cosmos DB MongoDB collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The RUs per second of the parameters to provide for the current MongoDB collection. + /// The cancellation token to use. + /// , , , , or is null. + public virtual MongoDBResourcesUpdateMongoDBCollectionThroughputOperation StartUpdateMongoDBCollectionThroughput(string resourceGroupName, string accountName, string databaseName, string collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartUpdateMongoDBCollectionThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.UpdateMongoDBCollectionThroughput(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters, cancellationToken); + return new MongoDBResourcesUpdateMongoDBCollectionThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateMongoDBCollectionThroughputRequest(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartMigrateMongoDBCollectionToAutoscaleAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartMigrateMongoDBCollectionToAutoscale"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateMongoDBCollectionToAutoscaleAsync(resourceGroupName, accountName, databaseName, collectionName, cancellationToken).ConfigureAwait(false); + return new MongoDBResourcesMigrateMongoDBCollectionToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateMongoDBCollectionToAutoscaleRequest(resourceGroupName, accountName, databaseName, collectionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public virtual MongoDBResourcesMigrateMongoDBCollectionToAutoscaleOperation StartMigrateMongoDBCollectionToAutoscale(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartMigrateMongoDBCollectionToAutoscale"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateMongoDBCollectionToAutoscale(resourceGroupName, accountName, databaseName, collectionName, cancellationToken); + return new MongoDBResourcesMigrateMongoDBCollectionToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateMongoDBCollectionToAutoscaleRequest(resourceGroupName, accountName, databaseName, collectionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartMigrateMongoDBCollectionToManualThroughputAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartMigrateMongoDBCollectionToManualThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateMongoDBCollectionToManualThroughputAsync(resourceGroupName, accountName, databaseName, collectionName, cancellationToken).ConfigureAwait(false); + return new MongoDBResourcesMigrateMongoDBCollectionToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateMongoDBCollectionToManualThroughputRequest(resourceGroupName, accountName, databaseName, collectionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public virtual MongoDBResourcesMigrateMongoDBCollectionToManualThroughputOperation StartMigrateMongoDBCollectionToManualThroughput(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var scope = _clientDiagnostics.CreateScope("MongoDBResourcesOperations.StartMigrateMongoDBCollectionToManualThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateMongoDBCollectionToManualThroughput(resourceGroupName, accountName, databaseName, collectionName, cancellationToken); + return new MongoDBResourcesMigrateMongoDBCollectionToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateMongoDBCollectionToManualThroughputRequest(resourceGroupName, accountName, databaseName, collectionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesRestOperations.cs new file mode 100644 index 000000000000..6cc803de286a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesRestOperations.cs @@ -0,0 +1,1608 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class MongoDBResourcesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of MongoDBResourcesRestOperations. + /// 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. + /// is null. + public MongoDBResourcesRestOperations(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 HttpMessage CreateListMongoDBDatabasesRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the MongoDB databases under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListMongoDBDatabasesAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListMongoDBDatabasesRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MongoDBDatabaseListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MongoDBDatabaseListResult.DeserializeMongoDBDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the MongoDB databases under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListMongoDBDatabases(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListMongoDBDatabasesRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MongoDBDatabaseListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MongoDBDatabaseListResult.DeserializeMongoDBDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetMongoDBDatabaseRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetMongoDBDatabaseAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetMongoDBDatabaseRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MongoDBDatabaseGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MongoDBDatabaseGetResults.DeserializeMongoDBDatabaseGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response GetMongoDBDatabase(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetMongoDBDatabaseRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MongoDBDatabaseGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MongoDBDatabaseGetResults.DeserializeMongoDBDatabaseGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateMongoDBDatabaseRequest(string resourceGroupName, string accountName, string databaseName, MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateMongoDBDatabaseParameters); + request.Content = content; + return message; + } + + /// Create or updates Azure Cosmos DB MongoDB database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the current MongoDB database. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateUpdateMongoDBDatabaseAsync(string resourceGroupName, string accountName, string databaseName, MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (createUpdateMongoDBDatabaseParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateMongoDBDatabaseParameters)); + } + + using var message = CreateCreateUpdateMongoDBDatabaseRequest(resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or updates Azure Cosmos DB MongoDB database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the current MongoDB database. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateUpdateMongoDBDatabase(string resourceGroupName, string accountName, string databaseName, MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (createUpdateMongoDBDatabaseParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateMongoDBDatabaseParameters)); + } + + using var message = CreateCreateUpdateMongoDBDatabaseRequest(resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteMongoDBDatabaseRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB MongoDB database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteMongoDBDatabaseAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateDeleteMongoDBDatabaseRequest(resourceGroupName, accountName, databaseName); + 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 an existing Azure Cosmos DB MongoDB database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response DeleteMongoDBDatabase(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateDeleteMongoDBDatabaseRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetMongoDBDatabaseThroughputRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetMongoDBDatabaseThroughputAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetMongoDBDatabaseThroughputRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response GetMongoDBDatabaseThroughput(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetMongoDBDatabaseThroughputRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateMongoDBDatabaseThroughputRequest(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateThroughputParameters); + request.Content = content; + return message; + } + + /// Update RUs per second of the an Azure Cosmos DB MongoDB database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The RUs per second of the parameters to provide for the current MongoDB database. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateMongoDBDatabaseThroughputAsync(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateMongoDBDatabaseThroughputRequest(resourceGroupName, accountName, databaseName, updateThroughputParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update RUs per second of the an Azure Cosmos DB MongoDB database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The RUs per second of the parameters to provide for the current MongoDB database. + /// The cancellation token to use. + /// , , , or is null. + public Response UpdateMongoDBDatabaseThroughput(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateMongoDBDatabaseThroughputRequest(resourceGroupName, accountName, databaseName, updateThroughputParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateMongoDBDatabaseToAutoscaleRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task MigrateMongoDBDatabaseToAutoscaleAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateMigrateMongoDBDatabaseToAutoscaleRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response MigrateMongoDBDatabaseToAutoscale(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateMigrateMongoDBDatabaseToAutoscaleRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateMongoDBDatabaseToManualThroughputRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task MigrateMongoDBDatabaseToManualThroughputAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateMigrateMongoDBDatabaseToManualThroughputRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response MigrateMongoDBDatabaseToManualThroughput(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateMigrateMongoDBDatabaseToManualThroughputRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListMongoDBCollectionsRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/collections", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the MongoDB collection under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListMongoDBCollectionsAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListMongoDBCollectionsRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MongoDBCollectionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MongoDBCollectionListResult.DeserializeMongoDBCollectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the MongoDB collection under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response ListMongoDBCollections(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListMongoDBCollectionsRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MongoDBCollectionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MongoDBCollectionListResult.DeserializeMongoDBCollectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetMongoDBCollectionRequest(string resourceGroupName, string accountName, string databaseName, string collectionName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the MongoDB collection under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetMongoDBCollectionAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var message = CreateGetMongoDBCollectionRequest(resourceGroupName, accountName, databaseName, collectionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MongoDBCollectionGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MongoDBCollectionGetResults.DeserializeMongoDBCollectionGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the MongoDB collection under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public Response GetMongoDBCollection(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var message = CreateGetMongoDBCollectionRequest(resourceGroupName, accountName, databaseName, collectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MongoDBCollectionGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MongoDBCollectionGetResults.DeserializeMongoDBCollectionGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateMongoDBCollectionRequest(string resourceGroupName, string accountName, string databaseName, string collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateMongoDBCollectionParameters); + request.Content = content; + return message; + } + + /// Create or update an Azure Cosmos DB MongoDB Collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The parameters to provide for the current MongoDB Collection. + /// The cancellation token to use. + /// , , , , or is null. + public async Task CreateUpdateMongoDBCollectionAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + if (createUpdateMongoDBCollectionParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateMongoDBCollectionParameters)); + } + + using var message = CreateCreateUpdateMongoDBCollectionRequest(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an Azure Cosmos DB MongoDB Collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The parameters to provide for the current MongoDB Collection. + /// The cancellation token to use. + /// , , , , or is null. + public Response CreateUpdateMongoDBCollection(string resourceGroupName, string accountName, string databaseName, string collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + if (createUpdateMongoDBCollectionParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateMongoDBCollectionParameters)); + } + + using var message = CreateCreateUpdateMongoDBCollectionRequest(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteMongoDBCollectionRequest(string resourceGroupName, string accountName, string databaseName, string collectionName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB MongoDB Collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public async Task DeleteMongoDBCollectionAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var message = CreateDeleteMongoDBCollectionRequest(resourceGroupName, accountName, databaseName, collectionName); + 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 an existing Azure Cosmos DB MongoDB Collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public Response DeleteMongoDBCollection(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var message = CreateDeleteMongoDBCollectionRequest(resourceGroupName, accountName, databaseName, collectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetMongoDBCollectionThroughputRequest(string resourceGroupName, string accountName, string databaseName, string collectionName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetMongoDBCollectionThroughputAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var message = CreateGetMongoDBCollectionThroughputRequest(resourceGroupName, accountName, databaseName, collectionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public Response GetMongoDBCollectionThroughput(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var message = CreateGetMongoDBCollectionThroughputRequest(resourceGroupName, accountName, databaseName, collectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateMongoDBCollectionThroughputRequest(string resourceGroupName, string accountName, string databaseName, string collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateThroughputParameters); + request.Content = content; + return message; + } + + /// Update the RUs per second of an Azure Cosmos DB MongoDB collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The RUs per second of the parameters to provide for the current MongoDB collection. + /// The cancellation token to use. + /// , , , , or is null. + public async Task UpdateMongoDBCollectionThroughputAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateMongoDBCollectionThroughputRequest(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update the RUs per second of an Azure Cosmos DB MongoDB collection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The RUs per second of the parameters to provide for the current MongoDB collection. + /// The cancellation token to use. + /// , , , , or is null. + public Response UpdateMongoDBCollectionThroughput(string resourceGroupName, string accountName, string databaseName, string collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateMongoDBCollectionThroughputRequest(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateMongoDBCollectionToAutoscaleRequest(string resourceGroupName, string accountName, string databaseName, string collectionName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionName, true); + uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public async Task MigrateMongoDBCollectionToAutoscaleAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var message = CreateMigrateMongoDBCollectionToAutoscaleRequest(resourceGroupName, accountName, databaseName, collectionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public Response MigrateMongoDBCollectionToAutoscale(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var message = CreateMigrateMongoDBCollectionToAutoscaleRequest(resourceGroupName, accountName, databaseName, collectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateMongoDBCollectionToManualThroughputRequest(string resourceGroupName, string accountName, string databaseName, string collectionName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/mongodbDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionName, true); + uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public async Task MigrateMongoDBCollectionToManualThroughputAsync(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var message = CreateMigrateMongoDBCollectionToManualThroughputRequest(resourceGroupName, accountName, databaseName, collectionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB collection name. + /// The cancellation token to use. + /// , , , or is null. + public Response MigrateMongoDBCollectionToManualThroughput(string resourceGroupName, string accountName, string databaseName, string collectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (collectionName == null) + { + throw new ArgumentNullException(nameof(collectionName)); + } + + using var message = CreateMigrateMongoDBCollectionToManualThroughputRequest(resourceGroupName, accountName, databaseName, collectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesUpdateMongoDBCollectionThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesUpdateMongoDBCollectionThroughputOperation.cs new file mode 100644 index 000000000000..3e102aa9b697 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesUpdateMongoDBCollectionThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Update the RUs per second of an Azure Cosmos DB MongoDB collection. + public partial class MongoDBResourcesUpdateMongoDBCollectionThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal MongoDBResourcesUpdateMongoDBCollectionThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "MongoDBResourcesUpdateMongoDBCollectionThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesUpdateMongoDBDatabaseThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesUpdateMongoDBDatabaseThroughputOperation.cs new file mode 100644 index 000000000000..0386122117ff --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesUpdateMongoDBDatabaseThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Update RUs per second of the an Azure Cosmos DB MongoDB database. + public partial class MongoDBResourcesUpdateMongoDBDatabaseThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal MongoDBResourcesUpdateMongoDBDatabaseThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "MongoDBResourcesUpdateMongoDBDatabaseThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesCreateOrUpdateOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..af856c2a8968 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesCreateOrUpdateOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Creates the notebook workspace for a Cosmos DB account. + public partial class NotebookWorkspacesCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal NotebookWorkspacesCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "NotebookWorkspacesCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override NotebookWorkspace 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); + + NotebookWorkspace IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return NotebookWorkspace.DeserializeNotebookWorkspace(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return NotebookWorkspace.DeserializeNotebookWorkspace(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesDeleteOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesDeleteOperation.cs new file mode 100644 index 000000000000..379e99518378 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesDeleteOperation.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.ResourceManager.CosmosDB +{ + /// Deletes the notebook workspace for a Cosmos DB account. + public partial class NotebookWorkspacesDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal NotebookWorkspacesDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "NotebookWorkspacesDeleteOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesOperations.cs new file mode 100644 index 000000000000..d729324a226b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesOperations.cs @@ -0,0 +1,446 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The NotebookWorkspaces service client. + public partial class NotebookWorkspacesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal NotebookWorkspacesRestOperations RestClient { get; } + /// Initializes a new instance of NotebookWorkspacesOperations for mocking. + protected NotebookWorkspacesOperations() + { + } + /// Initializes a new instance of NotebookWorkspacesOperations. + /// 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 NotebookWorkspacesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new NotebookWorkspacesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the notebook workspace for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, accountName, notebookWorkspaceName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the notebook workspace for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, accountName, notebookWorkspaceName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves the connection info for the notebook workspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + public virtual async Task> ListConnectionInfoAsync(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.ListConnectionInfo"); + scope.Start(); + try + { + return await RestClient.ListConnectionInfoAsync(resourceGroupName, accountName, notebookWorkspaceName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves the connection info for the notebook workspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + public virtual Response ListConnectionInfo(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.ListConnectionInfo"); + scope.Start(); + try + { + return RestClient.ListConnectionInfo(resourceGroupName, accountName, notebookWorkspaceName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the notebook workspace resources of an existing Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListByDatabaseAccountAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.ListByDatabaseAccount"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAccountAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Gets the notebook workspace resources of an existing Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListByDatabaseAccount(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.ListByDatabaseAccount"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseAccount(resourceGroupName, accountName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Creates the notebook workspace for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The notebook workspace to create for the current database account. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, ARMProxyResource notebookCreateUpdateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (notebookCreateUpdateParameters == null) + { + throw new ArgumentNullException(nameof(notebookCreateUpdateParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, cancellationToken).ConfigureAwait(false); + return new NotebookWorkspacesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates the notebook workspace for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The notebook workspace to create for the current database account. + /// The cancellation token to use. + /// , , or is null. + public virtual NotebookWorkspacesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, ARMProxyResource notebookCreateUpdateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (notebookCreateUpdateParameters == null) + { + throw new ArgumentNullException(nameof(notebookCreateUpdateParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, cancellationToken); + return new NotebookWorkspacesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes the notebook workspace for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public virtual async Task StartDeleteAsync(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, accountName, notebookWorkspaceName, cancellationToken).ConfigureAwait(false); + return new NotebookWorkspacesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, accountName, notebookWorkspaceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes the notebook workspace for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public virtual NotebookWorkspacesDeleteOperation StartDelete(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, accountName, notebookWorkspaceName, cancellationToken); + return new NotebookWorkspacesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, accountName, notebookWorkspaceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Regenerates the auth token for the notebook workspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public virtual async Task StartRegenerateAuthTokenAsync(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.StartRegenerateAuthToken"); + scope.Start(); + try + { + var originalResponse = await RestClient.RegenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName, cancellationToken).ConfigureAwait(false); + return new NotebookWorkspacesRegenerateAuthTokenOperation(_clientDiagnostics, _pipeline, RestClient.CreateRegenerateAuthTokenRequest(resourceGroupName, accountName, notebookWorkspaceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Regenerates the auth token for the notebook workspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public virtual NotebookWorkspacesRegenerateAuthTokenOperation StartRegenerateAuthToken(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.StartRegenerateAuthToken"); + scope.Start(); + try + { + var originalResponse = RestClient.RegenerateAuthToken(resourceGroupName, accountName, notebookWorkspaceName, cancellationToken); + return new NotebookWorkspacesRegenerateAuthTokenOperation(_clientDiagnostics, _pipeline, RestClient.CreateRegenerateAuthTokenRequest(resourceGroupName, accountName, notebookWorkspaceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Starts the notebook workspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public virtual async Task StartStartAsync(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.StartStart"); + scope.Start(); + try + { + var originalResponse = await RestClient.StartAsync(resourceGroupName, accountName, notebookWorkspaceName, cancellationToken).ConfigureAwait(false); + return new NotebookWorkspacesStartOperation(_clientDiagnostics, _pipeline, RestClient.CreateStartRequest(resourceGroupName, accountName, notebookWorkspaceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Starts the notebook workspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public virtual NotebookWorkspacesStartOperation StartStart(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var scope = _clientDiagnostics.CreateScope("NotebookWorkspacesOperations.StartStart"); + scope.Start(); + try + { + var originalResponse = RestClient.Start(resourceGroupName, accountName, notebookWorkspaceName, cancellationToken); + return new NotebookWorkspacesStartOperation(_clientDiagnostics, _pipeline, RestClient.CreateStartRequest(resourceGroupName, accountName, notebookWorkspaceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesRegenerateAuthTokenOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesRegenerateAuthTokenOperation.cs new file mode 100644 index 000000000000..a3543a6c2323 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesRegenerateAuthTokenOperation.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.ResourceManager.CosmosDB +{ + /// Regenerates the auth token for the notebook workspace. + public partial class NotebookWorkspacesRegenerateAuthTokenOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal NotebookWorkspacesRegenerateAuthTokenOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "NotebookWorkspacesRegenerateAuthTokenOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesRestOperations.cs new file mode 100644 index 000000000000..8524dae5e0f6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesRestOperations.cs @@ -0,0 +1,628 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class NotebookWorkspacesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of NotebookWorkspacesRestOperations. + /// 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. + /// is null. + public NotebookWorkspacesRestOperations(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 HttpMessage CreateListByDatabaseAccountRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/notebookWorkspaces", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the notebook workspace resources of an existing Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListByDatabaseAccountAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListByDatabaseAccountRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NotebookWorkspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NotebookWorkspaceListResult.DeserializeNotebookWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the notebook workspace resources of an existing Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListByDatabaseAccount(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListByDatabaseAccountRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NotebookWorkspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NotebookWorkspaceListResult.DeserializeNotebookWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/notebookWorkspaces/", false); + uri.AppendPath(notebookWorkspaceName.ToString(), true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the notebook workspace for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public async Task> GetAsync(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateGetRequest(resourceGroupName, accountName, notebookWorkspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NotebookWorkspace value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NotebookWorkspace.DeserializeNotebookWorkspace(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the notebook workspace for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public Response Get(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateGetRequest(resourceGroupName, accountName, notebookWorkspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NotebookWorkspace value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NotebookWorkspace.DeserializeNotebookWorkspace(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, ARMProxyResource notebookCreateUpdateParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/notebookWorkspaces/", false); + uri.AppendPath(notebookWorkspaceName.ToString(), true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(notebookCreateUpdateParameters); + request.Content = content; + return message; + } + + /// Creates the notebook workspace for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The notebook workspace to create for the current database account. + /// The cancellation token to use. + /// , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, ARMProxyResource notebookCreateUpdateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (notebookCreateUpdateParameters == null) + { + throw new ArgumentNullException(nameof(notebookCreateUpdateParameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters); + 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); + } + } + + /// Creates the notebook workspace for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The notebook workspace to create for the current database account. + /// The cancellation token to use. + /// , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, ARMProxyResource notebookCreateUpdateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (notebookCreateUpdateParameters == null) + { + throw new ArgumentNullException(nameof(notebookCreateUpdateParameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/notebookWorkspaces/", false); + uri.AppendPath(notebookWorkspaceName.ToString(), true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes the notebook workspace for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public async Task DeleteAsync(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, accountName, notebookWorkspaceName); + 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 notebook workspace for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public Response Delete(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, accountName, notebookWorkspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListConnectionInfoRequest(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/notebookWorkspaces/", false); + uri.AppendPath(notebookWorkspaceName.ToString(), true); + uri.AppendPath("/listConnectionInfo", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Retrieves the connection info for the notebook workspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public async Task> ListConnectionInfoAsync(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListConnectionInfoRequest(resourceGroupName, accountName, notebookWorkspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NotebookWorkspaceConnectionInfoResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NotebookWorkspaceConnectionInfoResult.DeserializeNotebookWorkspaceConnectionInfoResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the connection info for the notebook workspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public Response ListConnectionInfo(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListConnectionInfoRequest(resourceGroupName, accountName, notebookWorkspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NotebookWorkspaceConnectionInfoResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NotebookWorkspaceConnectionInfoResult.DeserializeNotebookWorkspaceConnectionInfoResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRegenerateAuthTokenRequest(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/notebookWorkspaces/", false); + uri.AppendPath(notebookWorkspaceName.ToString(), true); + uri.AppendPath("/regenerateAuthToken", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Regenerates the auth token for the notebook workspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public async Task RegenerateAuthTokenAsync(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateRegenerateAuthTokenRequest(resourceGroupName, accountName, notebookWorkspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Regenerates the auth token for the notebook workspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public Response RegenerateAuthToken(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateRegenerateAuthTokenRequest(resourceGroupName, accountName, notebookWorkspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateStartRequest(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/notebookWorkspaces/", false); + uri.AppendPath(notebookWorkspaceName.ToString(), true); + uri.AppendPath("/start", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Starts the notebook workspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public async Task StartAsync(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateStartRequest(resourceGroupName, accountName, notebookWorkspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Starts the notebook workspace. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the notebook workspace resource. + /// The cancellation token to use. + /// or is null. + public Response Start(string resourceGroupName, string accountName, NotebookWorkspaceName notebookWorkspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateStartRequest(resourceGroupName, accountName, notebookWorkspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesStartOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesStartOperation.cs new file mode 100644 index 000000000000..0d1be96bcab3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesStartOperation.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.ResourceManager.CosmosDB +{ + /// Starts the notebook workspace. + public partial class NotebookWorkspacesStartOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal NotebookWorkspacesStartOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "NotebookWorkspacesStartOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Operations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Operations.cs new file mode 100644 index 000000000000..9c719fc7a833 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Operations.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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The service client. + public partial class Operations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal RestOperations RestClient { get; } + /// Initializes a new instance of Operations for mocking. + protected Operations() + { + } + /// Initializes a new instance of Operations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + internal Operations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + RestClient = new RestOperations(clientDiagnostics, pipeline, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Lists all of the available Cosmos DB Resource Provider operations. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("Operations.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("Operations.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 Cosmos DB Resource Provider operations. + /// The cancellation token to use. + public virtual Pageable List(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("Operations.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("Operations.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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdOperations.cs new file mode 100644 index 000000000000..fcc1c194f19a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdOperations.cs @@ -0,0 +1,148 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The PartitionKeyRangeId service client. + public partial class PartitionKeyRangeIdOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal PartitionKeyRangeIdRestOperations RestClient { get; } + /// Initializes a new instance of PartitionKeyRangeIdOperations for mocking. + protected PartitionKeyRangeIdOperations() + { + } + /// Initializes a new instance of PartitionKeyRangeIdOperations. + /// 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 PartitionKeyRangeIdOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new PartitionKeyRangeIdRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Retrieves the metrics determined by the given filter for the given partition key range id. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// Partition Key Range Id for which to get data. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual AsyncPageable ListMetricsAsync(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string partitionKeyRangeId, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (partitionKeyRangeId == null) + { + throw new ArgumentNullException(nameof(partitionKeyRangeId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PartitionKeyRangeIdOperations.ListMetrics"); + scope.Start(); + try + { + var response = await RestClient.ListMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the metrics determined by the given filter for the given partition key range id. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// Partition Key Range Id for which to get data. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual Pageable ListMetrics(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string partitionKeyRangeId, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (partitionKeyRangeId == null) + { + throw new ArgumentNullException(nameof(partitionKeyRangeId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PartitionKeyRangeIdOperations.ListMetrics"); + scope.Start(); + try + { + var response = RestClient.ListMetrics(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionOperations.cs new file mode 100644 index 000000000000..460986f6d42f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionOperations.cs @@ -0,0 +1,158 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The PartitionKeyRangeIdRegion service client. + public partial class PartitionKeyRangeIdRegionOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal PartitionKeyRangeIdRegionRestOperations RestClient { get; } + /// Initializes a new instance of PartitionKeyRangeIdRegionOperations for mocking. + protected PartitionKeyRangeIdRegionOperations() + { + } + /// Initializes a new instance of PartitionKeyRangeIdRegionOperations. + /// 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 PartitionKeyRangeIdRegionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new PartitionKeyRangeIdRegionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Retrieves the metrics determined by the given filter for the given partition key range id and region. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// Partition Key Range Id for which to get data. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , , or is null. + public virtual AsyncPageable ListMetricsAsync(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string partitionKeyRangeId, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (partitionKeyRangeId == null) + { + throw new ArgumentNullException(nameof(partitionKeyRangeId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PartitionKeyRangeIdRegionOperations.ListMetrics"); + scope.Start(); + try + { + var response = await RestClient.ListMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the metrics determined by the given filter for the given partition key range id and region. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// Partition Key Range Id for which to get data. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , , or is null. + public virtual Pageable ListMetrics(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string partitionKeyRangeId, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (partitionKeyRangeId == null) + { + throw new ArgumentNullException(nameof(partitionKeyRangeId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PartitionKeyRangeIdRegionOperations.ListMetrics"); + scope.Start(); + try + { + var response = RestClient.ListMetrics(resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionRestOperations.cs new file mode 100644 index 000000000000..6da30868ae75 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionRestOperations.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class PartitionKeyRangeIdRegionRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of PartitionKeyRangeIdRegionRestOperations. + /// 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. + /// is null. + public PartitionKeyRangeIdRegionRestOperations(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 HttpMessage CreateListMetricsRequest(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string partitionKeyRangeId, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/region/", false); + uri.AppendPath(region, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseRid, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionRid, true); + uri.AppendPath("/partitionKeyRangeId/", false); + uri.AppendPath(partitionKeyRangeId, true); + uri.AppendPath("/metrics", false); + uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + return message; + } + + /// Retrieves the metrics determined by the given filter for the given partition key range id and region. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// Partition Key Range Id for which to get data. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , , or is null. + public async Task> ListMetricsAsync(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string partitionKeyRangeId, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (partitionKeyRangeId == null) + { + throw new ArgumentNullException(nameof(partitionKeyRangeId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PartitionMetricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PartitionMetricListResult.DeserializePartitionMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the metrics determined by the given filter for the given partition key range id and region. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// Partition Key Range Id for which to get data. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , , or is null. + public Response ListMetrics(string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string partitionKeyRangeId, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (partitionKeyRangeId == null) + { + throw new ArgumentNullException(nameof(partitionKeyRangeId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PartitionMetricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PartitionMetricListResult.DeserializePartitionMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRestOperations.cs new file mode 100644 index 000000000000..09bfbd688310 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRestOperations.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class PartitionKeyRangeIdRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of PartitionKeyRangeIdRestOperations. + /// 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. + /// is null. + public PartitionKeyRangeIdRestOperations(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 HttpMessage CreateListMetricsRequest(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string partitionKeyRangeId, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseRid, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionRid, true); + uri.AppendPath("/partitionKeyRangeId/", false); + uri.AppendPath(partitionKeyRangeId, true); + uri.AppendPath("/metrics", false); + uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + return message; + } + + /// Retrieves the metrics determined by the given filter for the given partition key range id. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// Partition Key Range Id for which to get data. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , or is null. + public async Task> ListMetricsAsync(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string partitionKeyRangeId, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (partitionKeyRangeId == null) + { + throw new ArgumentNullException(nameof(partitionKeyRangeId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PartitionMetricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PartitionMetricListResult.DeserializePartitionMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the metrics determined by the given filter for the given partition key range id. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database rid. + /// Cosmos DB collection rid. + /// Partition Key Range Id for which to get data. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , , or is null. + public Response ListMetrics(string resourceGroupName, string accountName, string databaseRid, string collectionRid, string partitionKeyRangeId, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseRid == null) + { + throw new ArgumentNullException(nameof(databaseRid)); + } + if (collectionRid == null) + { + throw new ArgumentNullException(nameof(collectionRid)); + } + if (partitionKeyRangeId == null) + { + throw new ArgumentNullException(nameof(partitionKeyRangeId)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PartitionMetricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PartitionMetricListResult.DeserializePartitionMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileOperations.cs new file mode 100644 index 000000000000..bd6f0cfc519e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileOperations.cs @@ -0,0 +1,118 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The Percentile service client. + public partial class PercentileOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal PercentileRestOperations RestClient { get; } + /// Initializes a new instance of PercentileOperations for mocking. + protected PercentileOperations() + { + } + /// Initializes a new instance of PercentileOperations. + /// 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 PercentileOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new PercentileRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListMetricsAsync(string resourceGroupName, string accountName, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PercentileOperations.ListMetrics"); + scope.Start(); + try + { + var response = await RestClient.ListMetricsAsync(resourceGroupName, accountName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListMetrics(string resourceGroupName, string accountName, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PercentileOperations.ListMetrics"); + scope.Start(); + try + { + var response = RestClient.ListMetrics(resourceGroupName, accountName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileRestOperations.cs new file mode 100644 index 000000000000..5f0dde11c4f0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileRestOperations.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class PercentileRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of PercentileRestOperations. + /// 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. + /// is null. + public PercentileRestOperations(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 HttpMessage CreateListMetricsRequest(string resourceGroupName, string accountName, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/percentile/metrics", false); + uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + return message; + } + + /// Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListMetricsAsync(string resourceGroupName, string accountName, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PercentileMetricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PercentileMetricListResult.DeserializePercentileMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , or is null. + public Response ListMetrics(string resourceGroupName, string accountName, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PercentileMetricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PercentileMetricListResult.DeserializePercentileMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetOperations.cs new file mode 100644 index 000000000000..107efc28a261 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetOperations.cs @@ -0,0 +1,138 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The PercentileSourceTarget service client. + public partial class PercentileSourceTargetOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal PercentileSourceTargetRestOperations RestClient { get; } + /// Initializes a new instance of PercentileSourceTargetOperations for mocking. + protected PercentileSourceTargetOperations() + { + } + /// Initializes a new instance of PercentileSourceTargetOperations. + /// 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 PercentileSourceTargetOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new PercentileSourceTargetRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. + /// Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , or is null. + public virtual AsyncPageable ListMetricsAsync(string resourceGroupName, string accountName, string sourceRegion, string targetRegion, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (sourceRegion == null) + { + throw new ArgumentNullException(nameof(sourceRegion)); + } + if (targetRegion == null) + { + throw new ArgumentNullException(nameof(targetRegion)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PercentileSourceTargetOperations.ListMetrics"); + scope.Start(); + try + { + var response = await RestClient.ListMetricsAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. + /// Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , or is null. + public virtual Pageable ListMetrics(string resourceGroupName, string accountName, string sourceRegion, string targetRegion, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (sourceRegion == null) + { + throw new ArgumentNullException(nameof(sourceRegion)); + } + if (targetRegion == null) + { + throw new ArgumentNullException(nameof(targetRegion)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PercentileSourceTargetOperations.ListMetrics"); + scope.Start(); + try + { + var response = RestClient.ListMetrics(resourceGroupName, accountName, sourceRegion, targetRegion, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetRestOperations.cs new file mode 100644 index 000000000000..3e365433af9a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetRestOperations.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class PercentileSourceTargetRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of PercentileSourceTargetRestOperations. + /// 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. + /// is null. + public PercentileSourceTargetRestOperations(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 HttpMessage CreateListMetricsRequest(string resourceGroupName, string accountName, string sourceRegion, string targetRegion, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sourceRegion/", false); + uri.AppendPath(sourceRegion, true); + uri.AppendPath("/targetRegion/", false); + uri.AppendPath(targetRegion, true); + uri.AppendPath("/percentile/metrics", false); + uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + return message; + } + + /// Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. + /// Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> ListMetricsAsync(string resourceGroupName, string accountName, string sourceRegion, string targetRegion, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (sourceRegion == null) + { + throw new ArgumentNullException(nameof(sourceRegion)); + } + if (targetRegion == null) + { + throw new ArgumentNullException(nameof(targetRegion)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, sourceRegion, targetRegion, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PercentileMetricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PercentileMetricListResult.DeserializePercentileMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. + /// Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , , or is null. + public Response ListMetrics(string resourceGroupName, string accountName, string sourceRegion, string targetRegion, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (sourceRegion == null) + { + throw new ArgumentNullException(nameof(sourceRegion)); + } + if (targetRegion == null) + { + throw new ArgumentNullException(nameof(targetRegion)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, sourceRegion, targetRegion, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PercentileMetricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PercentileMetricListResult.DeserializePercentileMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetOperations.cs new file mode 100644 index 000000000000..6cae1fd6a995 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetOperations.cs @@ -0,0 +1,128 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The PercentileTarget service client. + public partial class PercentileTargetOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal PercentileTargetRestOperations RestClient { get; } + /// Initializes a new instance of PercentileTargetOperations for mocking. + protected PercentileTargetOperations() + { + } + /// Initializes a new instance of PercentileTargetOperations. + /// 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 PercentileTargetOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new PercentileTargetRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , or is null. + public virtual AsyncPageable ListMetricsAsync(string resourceGroupName, string accountName, string targetRegion, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (targetRegion == null) + { + throw new ArgumentNullException(nameof(targetRegion)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PercentileTargetOperations.ListMetrics"); + scope.Start(); + try + { + var response = await RestClient.ListMetricsAsync(resourceGroupName, accountName, targetRegion, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , or is null. + public virtual Pageable ListMetrics(string resourceGroupName, string accountName, string targetRegion, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (targetRegion == null) + { + throw new ArgumentNullException(nameof(targetRegion)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PercentileTargetOperations.ListMetrics"); + scope.Start(); + try + { + var response = RestClient.ListMetrics(resourceGroupName, accountName, targetRegion, filter, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetRestOperations.cs new file mode 100644 index 000000000000..8f643128156d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetRestOperations.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class PercentileTargetRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of PercentileTargetRestOperations. + /// 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. + /// is null. + public PercentileTargetRestOperations(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 HttpMessage CreateListMetricsRequest(string resourceGroupName, string accountName, string targetRegion, 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/targetRegion/", false); + uri.AppendPath(targetRegion, true); + uri.AppendPath("/percentile/metrics", false); + uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + return message; + } + + /// Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListMetricsAsync(string resourceGroupName, string accountName, string targetRegion, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (targetRegion == null) + { + throw new ArgumentNullException(nameof(targetRegion)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, targetRegion, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PercentileMetricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PercentileMetricListResult.DeserializePercentileMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + /// An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + /// The cancellation token to use. + /// , , , or is null. + public Response ListMetrics(string resourceGroupName, string accountName, string targetRegion, string filter, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (targetRegion == null) + { + throw new ArgumentNullException(nameof(targetRegion)); + } + if (filter == null) + { + throw new ArgumentNullException(nameof(filter)); + } + + using var message = CreateListMetricsRequest(resourceGroupName, accountName, targetRegion, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PercentileMetricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PercentileMetricListResult.DeserializePercentileMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsCreateOrUpdateOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..3761a9e34092 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsCreateOrUpdateOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Approve or reject a private endpoint connection with a given name. + public partial class PrivateEndpointConnectionsCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal PrivateEndpointConnectionsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "PrivateEndpointConnectionsCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override PrivateEndpointConnectionAutoGenerated 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); + + PrivateEndpointConnectionAutoGenerated IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return PrivateEndpointConnectionAutoGenerated.DeserializePrivateEndpointConnectionAutoGenerated(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return PrivateEndpointConnectionAutoGenerated.DeserializePrivateEndpointConnectionAutoGenerated(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsDeleteOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsDeleteOperation.cs new file mode 100644 index 000000000000..4cc158349f20 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsDeleteOperation.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.ResourceManager.CosmosDB +{ + /// Deletes a private endpoint connection with a given name. + public partial class PrivateEndpointConnectionsDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal PrivateEndpointConnectionsDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "PrivateEndpointConnectionsDeleteOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..e5afe82d97cd --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -0,0 +1,298 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The PrivateEndpointConnections service client. + public partial class PrivateEndpointConnectionsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal PrivateEndpointConnectionsRestOperations RestClient { get; } + /// Initializes a new instance of PrivateEndpointConnectionsOperations for mocking. + protected PrivateEndpointConnectionsOperations() + { + } + /// Initializes a new instance of PrivateEndpointConnectionsOperations. + /// 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 PrivateEndpointConnectionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new PrivateEndpointConnectionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a private endpoint connection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private endpoint connection. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, accountName, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a private endpoint connection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private endpoint connection. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, accountName, privateEndpointConnectionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List all private endpoint connections on a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListByDatabaseAccountAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsOperations.ListByDatabaseAccount"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAccountAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// List all private endpoint connections on a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListByDatabaseAccount(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsOperations.ListByDatabaseAccount"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseAccount(resourceGroupName, accountName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Approve or reject a private endpoint connection with a given name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private endpoint connection. + /// The PrivateEndpointConnectionAutoGenerated to use. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnectionAutoGenerated parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters, cancellationToken).ConfigureAwait(false); + return new PrivateEndpointConnectionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, accountName, privateEndpointConnectionName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Approve or reject a private endpoint connection with a given name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private endpoint connection. + /// The PrivateEndpointConnectionAutoGenerated to use. + /// The cancellation token to use. + /// , , , or is null. + public virtual PrivateEndpointConnectionsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnectionAutoGenerated parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, accountName, privateEndpointConnectionName, parameters, cancellationToken); + return new PrivateEndpointConnectionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, accountName, privateEndpointConnectionName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a private endpoint connection with a given name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + return new PrivateEndpointConnectionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, accountName, privateEndpointConnectionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a private endpoint connection with a given name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// , , or is null. + public virtual PrivateEndpointConnectionsDeleteOperation StartDelete(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, accountName, privateEndpointConnectionName, cancellationToken); + return new PrivateEndpointConnectionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, accountName, privateEndpointConnectionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsRestOperations.cs new file mode 100644 index 000000000000..366b0da92c20 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsRestOperations.cs @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class PrivateEndpointConnectionsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of PrivateEndpointConnectionsRestOperations. + /// 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. + /// is null. + public PrivateEndpointConnectionsRestOperations(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 HttpMessage CreateListByDatabaseAccountRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/privateEndpointConnections", false); + uri.AppendQuery("api-version", "2019-08-01-preview", true); + request.Uri = uri; + return message; + } + + /// List all private endpoint connections on a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListByDatabaseAccountAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListByDatabaseAccountRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PrivateEndpointConnectionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PrivateEndpointConnectionListResult.DeserializePrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List all private endpoint connections on a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListByDatabaseAccount(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListByDatabaseAccountRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PrivateEndpointConnectionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PrivateEndpointConnectionListResult.DeserializePrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string accountName, string privateEndpointConnectionName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/privateEndpointConnections/", false); + uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendQuery("api-version", "2019-08-01-preview", true); + request.Uri = uri; + return message; + } + + /// Gets a private endpoint connection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + + using var message = CreateGetRequest(resourceGroupName, accountName, privateEndpointConnectionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PrivateEndpointConnectionAutoGenerated value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PrivateEndpointConnectionAutoGenerated.DeserializePrivateEndpointConnectionAutoGenerated(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a private endpoint connection. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + + using var message = CreateGetRequest(resourceGroupName, accountName, privateEndpointConnectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PrivateEndpointConnectionAutoGenerated value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PrivateEndpointConnectionAutoGenerated.DeserializePrivateEndpointConnectionAutoGenerated(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnectionAutoGenerated 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/privateEndpointConnections/", false); + uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendQuery("api-version", "2019-08-01-preview", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Approve or reject a private endpoint connection with a given name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private endpoint connection. + /// The PrivateEndpointConnectionAutoGenerated to use. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnectionAutoGenerated parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, privateEndpointConnectionName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Approve or reject a private endpoint connection with a given name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private endpoint connection. + /// The PrivateEndpointConnectionAutoGenerated to use. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnectionAutoGenerated parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, privateEndpointConnectionName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string accountName, string privateEndpointConnectionName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/privateEndpointConnections/", false); + uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendQuery("api-version", "2019-08-01-preview", true); + request.Uri = uri; + return message; + } + + /// Deletes a private endpoint connection with a given name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, accountName, privateEndpointConnectionName); + 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 a private endpoint connection with a given name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// , , or is null. + public Response Delete(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, accountName, privateEndpointConnectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..7bf0856d7f75 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesOperations.cs @@ -0,0 +1,148 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The PrivateLinkResources service client. + public partial class PrivateLinkResourcesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal PrivateLinkResourcesRestOperations RestClient { get; } + /// Initializes a new instance of PrivateLinkResourcesOperations for mocking. + protected PrivateLinkResourcesOperations() + { + } + /// Initializes a new instance of PrivateLinkResourcesOperations. + /// 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 PrivateLinkResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new PrivateLinkResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the private link resources that need to be created for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private link resource. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string accountName, string groupName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateLinkResourcesOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, accountName, groupName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the private link resources that need to be created for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private link resource. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string accountName, string groupName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateLinkResourcesOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, accountName, groupName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the private link resources that need to be created for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListByDatabaseAccountAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateLinkResourcesOperations.ListByDatabaseAccount"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAccountAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Gets the private link resources that need to be created for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListByDatabaseAccount(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateLinkResourcesOperations.ListByDatabaseAccount"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseAccount(resourceGroupName, accountName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesRestOperations.cs new file mode 100644 index 000000000000..fb9d0d44cfea --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesRestOperations.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class PrivateLinkResourcesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of PrivateLinkResourcesRestOperations. + /// 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. + /// is null. + public PrivateLinkResourcesRestOperations(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 HttpMessage CreateListByDatabaseAccountRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/privateLinkResources", false); + uri.AppendQuery("api-version", "2019-08-01-preview", true); + request.Uri = uri; + return message; + } + + /// Gets the private link resources that need to be created for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListByDatabaseAccountAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListByDatabaseAccountRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PrivateLinkResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the private link resources that need to be created for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListByDatabaseAccount(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListByDatabaseAccountRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PrivateLinkResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string accountName, string groupName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/privateLinkResources/", false); + uri.AppendPath(groupName, true); + uri.AppendQuery("api-version", "2019-08-01-preview", true); + request.Uri = uri; + return message; + } + + /// Gets the private link resources that need to be created for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private link resource. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string accountName, string groupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (groupName == null) + { + throw new ArgumentNullException(nameof(groupName)); + } + + using var message = CreateGetRequest(resourceGroupName, accountName, groupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PrivateLinkResource value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PrivateLinkResource.DeserializePrivateLinkResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the private link resources that need to be created for a Cosmos DB account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The name of the private link resource. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string accountName, string groupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (groupName == null) + { + throw new ArgumentNullException(nameof(groupName)); + } + + using var message = CreateGetRequest(resourceGroupName, accountName, groupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PrivateLinkResource value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PrivateLinkResource.DeserializePrivateLinkResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations.cs new file mode 100644 index 000000000000..6fc97e183f41 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class RestOperations + { + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of RestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + public RestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + endpoint ??= new Uri("https://management.azure.com"); + + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal 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.DocumentDB/operations", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists all of the available Cosmos DB Resource Provider operations. + /// The cancellation token to use. + public async Task> 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); + 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 Cosmos DB Resource Provider 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); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal 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 Cosmos DB Resource Provider operations. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public async Task> 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); + 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 Cosmos DB Resource Provider operations. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + 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); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlContainerOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlContainerOperation.cs new file mode 100644 index 000000000000..a5bd5fcab443 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlContainerOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update an Azure Cosmos DB SQL container. + public partial class SqlResourcesCreateUpdateSqlContainerOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesCreateUpdateSqlContainerOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesCreateUpdateSqlContainerOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override SqlContainerGetResults 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); + + SqlContainerGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return SqlContainerGetResults.DeserializeSqlContainerGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return SqlContainerGetResults.DeserializeSqlContainerGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlDatabaseOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlDatabaseOperation.cs new file mode 100644 index 000000000000..d1d397ee1eb1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlDatabaseOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update an Azure Cosmos DB SQL database. + public partial class SqlResourcesCreateUpdateSqlDatabaseOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesCreateUpdateSqlDatabaseOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesCreateUpdateSqlDatabaseOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override SqlDatabaseGetResults 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); + + SqlDatabaseGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return SqlDatabaseGetResults.DeserializeSqlDatabaseGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return SqlDatabaseGetResults.DeserializeSqlDatabaseGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlStoredProcedureOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlStoredProcedureOperation.cs new file mode 100644 index 000000000000..c932c03134e7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlStoredProcedureOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update an Azure Cosmos DB SQL storedProcedure. + public partial class SqlResourcesCreateUpdateSqlStoredProcedureOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesCreateUpdateSqlStoredProcedureOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesCreateUpdateSqlStoredProcedureOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override SqlStoredProcedureGetResults 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); + + SqlStoredProcedureGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return SqlStoredProcedureGetResults.DeserializeSqlStoredProcedureGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return SqlStoredProcedureGetResults.DeserializeSqlStoredProcedureGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlTriggerOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlTriggerOperation.cs new file mode 100644 index 000000000000..8bd3c16c00f9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlTriggerOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update an Azure Cosmos DB SQL trigger. + public partial class SqlResourcesCreateUpdateSqlTriggerOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesCreateUpdateSqlTriggerOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesCreateUpdateSqlTriggerOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override SqlTriggerGetResults 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); + + SqlTriggerGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return SqlTriggerGetResults.DeserializeSqlTriggerGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return SqlTriggerGetResults.DeserializeSqlTriggerGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlUserDefinedFunctionOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlUserDefinedFunctionOperation.cs new file mode 100644 index 000000000000..6cc3ead41a8d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlUserDefinedFunctionOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update an Azure Cosmos DB SQL userDefinedFunction. + public partial class SqlResourcesCreateUpdateSqlUserDefinedFunctionOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesCreateUpdateSqlUserDefinedFunctionOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesCreateUpdateSqlUserDefinedFunctionOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override SqlUserDefinedFunctionGetResults 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); + + SqlUserDefinedFunctionGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return SqlUserDefinedFunctionGetResults.DeserializeSqlUserDefinedFunctionGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return SqlUserDefinedFunctionGetResults.DeserializeSqlUserDefinedFunctionGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlContainerOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlContainerOperation.cs new file mode 100644 index 000000000000..3ce361e51724 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlContainerOperation.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.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB SQL container. + public partial class SqlResourcesDeleteSqlContainerOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesDeleteSqlContainerOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesDeleteSqlContainerOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlDatabaseOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlDatabaseOperation.cs new file mode 100644 index 000000000000..fd48990b2102 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlDatabaseOperation.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.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB SQL database. + public partial class SqlResourcesDeleteSqlDatabaseOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesDeleteSqlDatabaseOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesDeleteSqlDatabaseOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlStoredProcedureOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlStoredProcedureOperation.cs new file mode 100644 index 000000000000..1942ba107740 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlStoredProcedureOperation.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.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB SQL storedProcedure. + public partial class SqlResourcesDeleteSqlStoredProcedureOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesDeleteSqlStoredProcedureOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesDeleteSqlStoredProcedureOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlTriggerOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlTriggerOperation.cs new file mode 100644 index 000000000000..728045e029bd --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlTriggerOperation.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.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB SQL trigger. + public partial class SqlResourcesDeleteSqlTriggerOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesDeleteSqlTriggerOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesDeleteSqlTriggerOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlUserDefinedFunctionOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlUserDefinedFunctionOperation.cs new file mode 100644 index 000000000000..93197771f6c3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlUserDefinedFunctionOperation.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.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + public partial class SqlResourcesDeleteSqlUserDefinedFunctionOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesDeleteSqlUserDefinedFunctionOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesDeleteSqlUserDefinedFunctionOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesMigrateSqlContainerToAutoscaleOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesMigrateSqlContainerToAutoscaleOperation.cs new file mode 100644 index 000000000000..a40480aa4c25 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesMigrateSqlContainerToAutoscaleOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + public partial class SqlResourcesMigrateSqlContainerToAutoscaleOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesMigrateSqlContainerToAutoscaleOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesMigrateSqlContainerToAutoscaleOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesMigrateSqlContainerToManualThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesMigrateSqlContainerToManualThroughputOperation.cs new file mode 100644 index 000000000000..774df2e19f97 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesMigrateSqlContainerToManualThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + public partial class SqlResourcesMigrateSqlContainerToManualThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesMigrateSqlContainerToManualThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesMigrateSqlContainerToManualThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesMigrateSqlDatabaseToAutoscaleOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesMigrateSqlDatabaseToAutoscaleOperation.cs new file mode 100644 index 000000000000..c96452f60423 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesMigrateSqlDatabaseToAutoscaleOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + public partial class SqlResourcesMigrateSqlDatabaseToAutoscaleOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesMigrateSqlDatabaseToAutoscaleOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesMigrateSqlDatabaseToAutoscaleOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesMigrateSqlDatabaseToManualThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesMigrateSqlDatabaseToManualThroughputOperation.cs new file mode 100644 index 000000000000..7540a197b6c6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesMigrateSqlDatabaseToManualThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + public partial class SqlResourcesMigrateSqlDatabaseToManualThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesMigrateSqlDatabaseToManualThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesMigrateSqlDatabaseToManualThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesOperations.cs new file mode 100644 index 000000000000..c57563358e1b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesOperations.cs @@ -0,0 +1,2106 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The SqlResources service client. + public partial class SqlResourcesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal SqlResourcesRestOperations RestClient { get; } + /// Initializes a new instance of SqlResourcesOperations for mocking. + protected SqlResourcesOperations() + { + } + /// Initializes a new instance of SqlResourcesOperations. + /// 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 SqlResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new SqlResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + public virtual async Task> GetSqlDatabaseAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlDatabase"); + scope.Start(); + try + { + return await RestClient.GetSqlDatabaseAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + public virtual Response GetSqlDatabase(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlDatabase"); + scope.Start(); + try + { + return RestClient.GetSqlDatabase(resourceGroupName, accountName, databaseName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + public virtual async Task> GetSqlDatabaseThroughputAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlDatabaseThroughput"); + scope.Start(); + try + { + return await RestClient.GetSqlDatabaseThroughputAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + public virtual Response GetSqlDatabaseThroughput(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlDatabaseThroughput"); + scope.Start(); + try + { + return RestClient.GetSqlDatabaseThroughput(resourceGroupName, accountName, databaseName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the SQL container under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + public virtual async Task> GetSqlContainerAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlContainer"); + scope.Start(); + try + { + return await RestClient.GetSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the SQL container under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + public virtual Response GetSqlContainer(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlContainer"); + scope.Start(); + try + { + return RestClient.GetSqlContainer(resourceGroupName, accountName, databaseName, containerName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + public virtual async Task> GetSqlContainerThroughputAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlContainerThroughput"); + scope.Start(); + try + { + return await RestClient.GetSqlContainerThroughputAsync(resourceGroupName, accountName, databaseName, containerName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + public virtual Response GetSqlContainerThroughput(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlContainerThroughput"); + scope.Start(); + try + { + return RestClient.GetSqlContainerThroughput(resourceGroupName, accountName, databaseName, containerName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB storedProcedure name. + /// The cancellation token to use. + public virtual async Task> GetSqlStoredProcedureAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlStoredProcedure"); + scope.Start(); + try + { + return await RestClient.GetSqlStoredProcedureAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB storedProcedure name. + /// The cancellation token to use. + public virtual Response GetSqlStoredProcedure(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlStoredProcedure"); + scope.Start(); + try + { + return RestClient.GetSqlStoredProcedure(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB userDefinedFunction name. + /// The cancellation token to use. + public virtual async Task> GetSqlUserDefinedFunctionAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlUserDefinedFunction"); + scope.Start(); + try + { + return await RestClient.GetSqlUserDefinedFunctionAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB userDefinedFunction name. + /// The cancellation token to use. + public virtual Response GetSqlUserDefinedFunction(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlUserDefinedFunction"); + scope.Start(); + try + { + return RestClient.GetSqlUserDefinedFunction(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the SQL trigger under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB trigger name. + /// The cancellation token to use. + public virtual async Task> GetSqlTriggerAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlTrigger"); + scope.Start(); + try + { + return await RestClient.GetSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the SQL trigger under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB trigger name. + /// The cancellation token to use. + public virtual Response GetSqlTrigger(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlTrigger"); + scope.Start(); + try + { + return RestClient.GetSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the SQL databases under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListSqlDatabasesAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlDatabases"); + scope.Start(); + try + { + var response = await RestClient.ListSqlDatabasesAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the SQL databases under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListSqlDatabases(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlDatabases"); + scope.Start(); + try + { + var response = RestClient.ListSqlDatabases(resourceGroupName, accountName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Lists the SQL container under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListSqlContainersAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlContainers"); + scope.Start(); + try + { + var response = await RestClient.ListSqlContainersAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the SQL container under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListSqlContainers(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlContainers"); + scope.Start(); + try + { + var response = RestClient.ListSqlContainers(resourceGroupName, accountName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public virtual AsyncPageable ListSqlStoredProceduresAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlStoredProcedures"); + scope.Start(); + try + { + var response = await RestClient.ListSqlStoredProceduresAsync(resourceGroupName, accountName, databaseName, containerName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public virtual Pageable ListSqlStoredProcedures(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlStoredProcedures"); + scope.Start(); + try + { + var response = RestClient.ListSqlStoredProcedures(resourceGroupName, accountName, databaseName, containerName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public virtual AsyncPageable ListSqlUserDefinedFunctionsAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlUserDefinedFunctions"); + scope.Start(); + try + { + var response = await RestClient.ListSqlUserDefinedFunctionsAsync(resourceGroupName, accountName, databaseName, containerName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public virtual Pageable ListSqlUserDefinedFunctions(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlUserDefinedFunctions"); + scope.Start(); + try + { + var response = RestClient.ListSqlUserDefinedFunctions(resourceGroupName, accountName, databaseName, containerName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Lists the SQL trigger under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public virtual AsyncPageable ListSqlTriggersAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlTriggers"); + scope.Start(); + try + { + var response = await RestClient.ListSqlTriggersAsync(resourceGroupName, accountName, databaseName, containerName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the SQL trigger under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public virtual Pageable ListSqlTriggers(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlTriggers"); + scope.Start(); + try + { + var response = RestClient.ListSqlTriggers(resourceGroupName, accountName, databaseName, containerName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Create or update an Azure Cosmos DB SQL database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the current SQL database. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateUpdateSqlDatabaseAsync(string resourceGroupName, string accountName, string databaseName, SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (createUpdateSqlDatabaseParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlDatabaseParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlDatabase"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateSqlDatabaseAsync(resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters, cancellationToken).ConfigureAwait(false); + return new SqlResourcesCreateUpdateSqlDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlDatabaseRequest(resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB SQL database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the current SQL database. + /// The cancellation token to use. + /// , , , or is null. + public virtual SqlResourcesCreateUpdateSqlDatabaseOperation StartCreateUpdateSqlDatabase(string resourceGroupName, string accountName, string databaseName, SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (createUpdateSqlDatabaseParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlDatabaseParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlDatabase"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateSqlDatabase(resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters, cancellationToken); + return new SqlResourcesCreateUpdateSqlDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlDatabaseRequest(resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteSqlDatabaseAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlDatabase"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + return new SqlResourcesDeleteSqlDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlDatabaseRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual SqlResourcesDeleteSqlDatabaseOperation StartDeleteSqlDatabase(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlDatabase"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteSqlDatabase(resourceGroupName, accountName, databaseName, cancellationToken); + return new SqlResourcesDeleteSqlDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlDatabaseRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB SQL database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the RUs per second of the current SQL database. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartUpdateSqlDatabaseThroughputAsync(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartUpdateSqlDatabaseThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateSqlDatabaseThroughputAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters, cancellationToken).ConfigureAwait(false); + return new SqlResourcesUpdateSqlDatabaseThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateSqlDatabaseThroughputRequest(resourceGroupName, accountName, databaseName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB SQL database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the RUs per second of the current SQL database. + /// The cancellation token to use. + /// , , , or is null. + public virtual SqlResourcesUpdateSqlDatabaseThroughputOperation StartUpdateSqlDatabaseThroughput(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartUpdateSqlDatabaseThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.UpdateSqlDatabaseThroughput(resourceGroupName, accountName, databaseName, updateThroughputParameters, cancellationToken); + return new SqlResourcesUpdateSqlDatabaseThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateSqlDatabaseThroughputRequest(resourceGroupName, accountName, databaseName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartMigrateSqlDatabaseToAutoscaleAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartMigrateSqlDatabaseToAutoscale"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateSqlDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + return new SqlResourcesMigrateSqlDatabaseToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateSqlDatabaseToAutoscaleRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual SqlResourcesMigrateSqlDatabaseToAutoscaleOperation StartMigrateSqlDatabaseToAutoscale(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartMigrateSqlDatabaseToAutoscale"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateSqlDatabaseToAutoscale(resourceGroupName, accountName, databaseName, cancellationToken); + return new SqlResourcesMigrateSqlDatabaseToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateSqlDatabaseToAutoscaleRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartMigrateSqlDatabaseToManualThroughputAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartMigrateSqlDatabaseToManualThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateSqlDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, cancellationToken).ConfigureAwait(false); + return new SqlResourcesMigrateSqlDatabaseToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateSqlDatabaseToManualThroughputRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public virtual SqlResourcesMigrateSqlDatabaseToManualThroughputOperation StartMigrateSqlDatabaseToManualThroughput(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartMigrateSqlDatabaseToManualThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateSqlDatabaseToManualThroughput(resourceGroupName, accountName, databaseName, cancellationToken); + return new SqlResourcesMigrateSqlDatabaseToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateSqlDatabaseToManualThroughputRequest(resourceGroupName, accountName, databaseName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB SQL container. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The parameters to provide for the current SQL container. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartCreateUpdateSqlContainerAsync(string resourceGroupName, string accountName, string databaseName, string containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (createUpdateSqlContainerParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlContainerParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlContainer"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters, cancellationToken).ConfigureAwait(false); + return new SqlResourcesCreateUpdateSqlContainerOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlContainerRequest(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB SQL container. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The parameters to provide for the current SQL container. + /// The cancellation token to use. + /// , , , , or is null. + public virtual SqlResourcesCreateUpdateSqlContainerOperation StartCreateUpdateSqlContainer(string resourceGroupName, string accountName, string databaseName, string containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (createUpdateSqlContainerParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlContainerParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlContainer"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateSqlContainer(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters, cancellationToken); + return new SqlResourcesCreateUpdateSqlContainerOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlContainerRequest(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL container. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartDeleteSqlContainerAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlContainer"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName, cancellationToken).ConfigureAwait(false); + return new SqlResourcesDeleteSqlContainerOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlContainerRequest(resourceGroupName, accountName, databaseName, containerName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL container. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public virtual SqlResourcesDeleteSqlContainerOperation StartDeleteSqlContainer(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlContainer"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteSqlContainer(resourceGroupName, accountName, databaseName, containerName, cancellationToken); + return new SqlResourcesDeleteSqlContainerOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlContainerRequest(resourceGroupName, accountName, databaseName, containerName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB SQL container. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The parameters to provide for the RUs per second of the current SQL container. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartUpdateSqlContainerThroughputAsync(string resourceGroupName, string accountName, string databaseName, string containerName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartUpdateSqlContainerThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateSqlContainerThroughputAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters, cancellationToken).ConfigureAwait(false); + return new SqlResourcesUpdateSqlContainerThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateSqlContainerThroughputRequest(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB SQL container. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The parameters to provide for the RUs per second of the current SQL container. + /// The cancellation token to use. + /// , , , , or is null. + public virtual SqlResourcesUpdateSqlContainerThroughputOperation StartUpdateSqlContainerThroughput(string resourceGroupName, string accountName, string databaseName, string containerName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartUpdateSqlContainerThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.UpdateSqlContainerThroughput(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters, cancellationToken); + return new SqlResourcesUpdateSqlContainerThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateSqlContainerThroughputRequest(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartMigrateSqlContainerToAutoscaleAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartMigrateSqlContainerToAutoscale"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateSqlContainerToAutoscaleAsync(resourceGroupName, accountName, databaseName, containerName, cancellationToken).ConfigureAwait(false); + return new SqlResourcesMigrateSqlContainerToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateSqlContainerToAutoscaleRequest(resourceGroupName, accountName, databaseName, containerName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public virtual SqlResourcesMigrateSqlContainerToAutoscaleOperation StartMigrateSqlContainerToAutoscale(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartMigrateSqlContainerToAutoscale"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateSqlContainerToAutoscale(resourceGroupName, accountName, databaseName, containerName, cancellationToken); + return new SqlResourcesMigrateSqlContainerToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateSqlContainerToAutoscaleRequest(resourceGroupName, accountName, databaseName, containerName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartMigrateSqlContainerToManualThroughputAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartMigrateSqlContainerToManualThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateSqlContainerToManualThroughputAsync(resourceGroupName, accountName, databaseName, containerName, cancellationToken).ConfigureAwait(false); + return new SqlResourcesMigrateSqlContainerToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateSqlContainerToManualThroughputRequest(resourceGroupName, accountName, databaseName, containerName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public virtual SqlResourcesMigrateSqlContainerToManualThroughputOperation StartMigrateSqlContainerToManualThroughput(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartMigrateSqlContainerToManualThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateSqlContainerToManualThroughput(resourceGroupName, accountName, databaseName, containerName, cancellationToken); + return new SqlResourcesMigrateSqlContainerToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateSqlContainerToManualThroughputRequest(resourceGroupName, accountName, databaseName, containerName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB SQL storedProcedure. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB storedProcedure name. + /// The parameters to provide for the current SQL storedProcedure. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual async Task StartCreateUpdateSqlStoredProcedureAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName, SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (storedProcedureName == null) + { + throw new ArgumentNullException(nameof(storedProcedureName)); + } + if (createUpdateSqlStoredProcedureParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlStoredProcedureParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlStoredProcedure"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateSqlStoredProcedureAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSqlStoredProcedureParameters, cancellationToken).ConfigureAwait(false); + return new SqlResourcesCreateUpdateSqlStoredProcedureOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlStoredProcedureRequest(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSqlStoredProcedureParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB SQL storedProcedure. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB storedProcedure name. + /// The parameters to provide for the current SQL storedProcedure. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual SqlResourcesCreateUpdateSqlStoredProcedureOperation StartCreateUpdateSqlStoredProcedure(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName, SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (storedProcedureName == null) + { + throw new ArgumentNullException(nameof(storedProcedureName)); + } + if (createUpdateSqlStoredProcedureParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlStoredProcedureParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlStoredProcedure"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateSqlStoredProcedure(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSqlStoredProcedureParameters, cancellationToken); + return new SqlResourcesCreateUpdateSqlStoredProcedureOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlStoredProcedureRequest(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSqlStoredProcedureParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL storedProcedure. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB storedProcedure name. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartDeleteSqlStoredProcedureAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (storedProcedureName == null) + { + throw new ArgumentNullException(nameof(storedProcedureName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlStoredProcedure"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteSqlStoredProcedureAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, cancellationToken).ConfigureAwait(false); + return new SqlResourcesDeleteSqlStoredProcedureOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlStoredProcedureRequest(resourceGroupName, accountName, databaseName, containerName, storedProcedureName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL storedProcedure. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB storedProcedure name. + /// The cancellation token to use. + /// , , , , or is null. + public virtual SqlResourcesDeleteSqlStoredProcedureOperation StartDeleteSqlStoredProcedure(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (storedProcedureName == null) + { + throw new ArgumentNullException(nameof(storedProcedureName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlStoredProcedure"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteSqlStoredProcedure(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, cancellationToken); + return new SqlResourcesDeleteSqlStoredProcedureOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlStoredProcedureRequest(resourceGroupName, accountName, databaseName, containerName, storedProcedureName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB SQL userDefinedFunction. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB userDefinedFunction name. + /// The parameters to provide for the current SQL userDefinedFunction. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual async Task StartCreateUpdateSqlUserDefinedFunctionAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (userDefinedFunctionName == null) + { + throw new ArgumentNullException(nameof(userDefinedFunctionName)); + } + if (createUpdateSqlUserDefinedFunctionParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlUserDefinedFunctionParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlUserDefinedFunction"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateSqlUserDefinedFunctionAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters, cancellationToken).ConfigureAwait(false); + return new SqlResourcesCreateUpdateSqlUserDefinedFunctionOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlUserDefinedFunctionRequest(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB SQL userDefinedFunction. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB userDefinedFunction name. + /// The parameters to provide for the current SQL userDefinedFunction. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual SqlResourcesCreateUpdateSqlUserDefinedFunctionOperation StartCreateUpdateSqlUserDefinedFunction(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (userDefinedFunctionName == null) + { + throw new ArgumentNullException(nameof(userDefinedFunctionName)); + } + if (createUpdateSqlUserDefinedFunctionParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlUserDefinedFunctionParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlUserDefinedFunction"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateSqlUserDefinedFunction(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters, cancellationToken); + return new SqlResourcesCreateUpdateSqlUserDefinedFunctionOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlUserDefinedFunctionRequest(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB userDefinedFunction name. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartDeleteSqlUserDefinedFunctionAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (userDefinedFunctionName == null) + { + throw new ArgumentNullException(nameof(userDefinedFunctionName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlUserDefinedFunction"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteSqlUserDefinedFunctionAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, cancellationToken).ConfigureAwait(false); + return new SqlResourcesDeleteSqlUserDefinedFunctionOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlUserDefinedFunctionRequest(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB userDefinedFunction name. + /// The cancellation token to use. + /// , , , , or is null. + public virtual SqlResourcesDeleteSqlUserDefinedFunctionOperation StartDeleteSqlUserDefinedFunction(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (userDefinedFunctionName == null) + { + throw new ArgumentNullException(nameof(userDefinedFunctionName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlUserDefinedFunction"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteSqlUserDefinedFunction(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, cancellationToken); + return new SqlResourcesDeleteSqlUserDefinedFunctionOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlUserDefinedFunctionRequest(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB SQL trigger. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB trigger name. + /// The parameters to provide for the current SQL trigger. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual async Task StartCreateUpdateSqlTriggerAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (triggerName == null) + { + throw new ArgumentNullException(nameof(triggerName)); + } + if (createUpdateSqlTriggerParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlTriggerParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlTrigger"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters, cancellationToken).ConfigureAwait(false); + return new SqlResourcesCreateUpdateSqlTriggerOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlTriggerRequest(resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB SQL trigger. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB trigger name. + /// The parameters to provide for the current SQL trigger. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual SqlResourcesCreateUpdateSqlTriggerOperation StartCreateUpdateSqlTrigger(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (triggerName == null) + { + throw new ArgumentNullException(nameof(triggerName)); + } + if (createUpdateSqlTriggerParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlTriggerParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlTrigger"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters, cancellationToken); + return new SqlResourcesCreateUpdateSqlTriggerOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlTriggerRequest(resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL trigger. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB trigger name. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartDeleteSqlTriggerAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (triggerName == null) + { + throw new ArgumentNullException(nameof(triggerName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlTrigger"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName, cancellationToken).ConfigureAwait(false); + return new SqlResourcesDeleteSqlTriggerOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlTriggerRequest(resourceGroupName, accountName, databaseName, containerName, triggerName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL trigger. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB trigger name. + /// The cancellation token to use. + /// , , , , or is null. + public virtual SqlResourcesDeleteSqlTriggerOperation StartDeleteSqlTrigger(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (triggerName == null) + { + throw new ArgumentNullException(nameof(triggerName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlTrigger"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName, cancellationToken); + return new SqlResourcesDeleteSqlTriggerOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlTriggerRequest(resourceGroupName, accountName, databaseName, containerName, triggerName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesRestOperations.cs new file mode 100644 index 000000000000..8d824dc681e1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesRestOperations.cs @@ -0,0 +1,2985 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class SqlResourcesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of SqlResourcesRestOperations. + /// 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. + /// is null. + public SqlResourcesRestOperations(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 HttpMessage CreateListSqlDatabasesRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the SQL databases under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListSqlDatabasesAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListSqlDatabasesRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlDatabaseListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlDatabaseListResult.DeserializeSqlDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the SQL databases under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListSqlDatabases(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListSqlDatabasesRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlDatabaseListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlDatabaseListResult.DeserializeSqlDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetSqlDatabaseRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetSqlDatabaseAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetSqlDatabaseRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlDatabaseGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlDatabaseGetResults.DeserializeSqlDatabaseGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response GetSqlDatabase(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetSqlDatabaseRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlDatabaseGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlDatabaseGetResults.DeserializeSqlDatabaseGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateSqlDatabaseRequest(string resourceGroupName, string accountName, string databaseName, SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateSqlDatabaseParameters); + request.Content = content; + return message; + } + + /// Create or update an Azure Cosmos DB SQL database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the current SQL database. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateUpdateSqlDatabaseAsync(string resourceGroupName, string accountName, string databaseName, SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (createUpdateSqlDatabaseParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlDatabaseParameters)); + } + + using var message = CreateCreateUpdateSqlDatabaseRequest(resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an Azure Cosmos DB SQL database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the current SQL database. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateUpdateSqlDatabase(string resourceGroupName, string accountName, string databaseName, SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (createUpdateSqlDatabaseParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlDatabaseParameters)); + } + + using var message = CreateCreateUpdateSqlDatabaseRequest(resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteSqlDatabaseRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB SQL database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteSqlDatabaseAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateDeleteSqlDatabaseRequest(resourceGroupName, accountName, databaseName); + 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 an existing Azure Cosmos DB SQL database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response DeleteSqlDatabase(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateDeleteSqlDatabaseRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetSqlDatabaseThroughputRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetSqlDatabaseThroughputAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetSqlDatabaseThroughputRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response GetSqlDatabaseThroughput(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetSqlDatabaseThroughputRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateSqlDatabaseThroughputRequest(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateThroughputParameters); + request.Content = content; + return message; + } + + /// Update RUs per second of an Azure Cosmos DB SQL database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the RUs per second of the current SQL database. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateSqlDatabaseThroughputAsync(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateSqlDatabaseThroughputRequest(resourceGroupName, accountName, databaseName, updateThroughputParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update RUs per second of an Azure Cosmos DB SQL database. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The parameters to provide for the RUs per second of the current SQL database. + /// The cancellation token to use. + /// , , , or is null. + public Response UpdateSqlDatabaseThroughput(string resourceGroupName, string accountName, string databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateSqlDatabaseThroughputRequest(resourceGroupName, accountName, databaseName, updateThroughputParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateSqlDatabaseToAutoscaleRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task MigrateSqlDatabaseToAutoscaleAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateMigrateSqlDatabaseToAutoscaleRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response MigrateSqlDatabaseToAutoscale(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateMigrateSqlDatabaseToAutoscaleRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateSqlDatabaseToManualThroughputRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task MigrateSqlDatabaseToManualThroughputAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateMigrateSqlDatabaseToManualThroughputRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response MigrateSqlDatabaseToManualThroughput(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateMigrateSqlDatabaseToManualThroughputRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListSqlContainersRequest(string resourceGroupName, string accountName, string databaseName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the SQL container under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListSqlContainersAsync(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListSqlContainersRequest(resourceGroupName, accountName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlContainerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlContainerListResult.DeserializeSqlContainerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the SQL container under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// The cancellation token to use. + /// , , or is null. + public Response ListSqlContainers(string resourceGroupName, string accountName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListSqlContainersRequest(resourceGroupName, accountName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlContainerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlContainerListResult.DeserializeSqlContainerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetSqlContainerRequest(string resourceGroupName, string accountName, string databaseName, string containerName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the SQL container under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetSqlContainerAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateGetSqlContainerRequest(resourceGroupName, accountName, databaseName, containerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlContainerGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlContainerGetResults.DeserializeSqlContainerGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the SQL container under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public Response GetSqlContainer(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateGetSqlContainerRequest(resourceGroupName, accountName, databaseName, containerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlContainerGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlContainerGetResults.DeserializeSqlContainerGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateSqlContainerRequest(string resourceGroupName, string accountName, string databaseName, string containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateSqlContainerParameters); + request.Content = content; + return message; + } + + /// Create or update an Azure Cosmos DB SQL container. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The parameters to provide for the current SQL container. + /// The cancellation token to use. + /// , , , , or is null. + public async Task CreateUpdateSqlContainerAsync(string resourceGroupName, string accountName, string databaseName, string containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (createUpdateSqlContainerParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlContainerParameters)); + } + + using var message = CreateCreateUpdateSqlContainerRequest(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an Azure Cosmos DB SQL container. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The parameters to provide for the current SQL container. + /// The cancellation token to use. + /// , , , , or is null. + public Response CreateUpdateSqlContainer(string resourceGroupName, string accountName, string databaseName, string containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (createUpdateSqlContainerParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlContainerParameters)); + } + + using var message = CreateCreateUpdateSqlContainerRequest(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteSqlContainerRequest(string resourceGroupName, string accountName, string databaseName, string containerName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB SQL container. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public async Task DeleteSqlContainerAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateDeleteSqlContainerRequest(resourceGroupName, accountName, databaseName, containerName); + 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 an existing Azure Cosmos DB SQL container. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public Response DeleteSqlContainer(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateDeleteSqlContainerRequest(resourceGroupName, accountName, databaseName, containerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetSqlContainerThroughputRequest(string resourceGroupName, string accountName, string databaseName, string containerName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetSqlContainerThroughputAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateGetSqlContainerThroughputRequest(resourceGroupName, accountName, databaseName, containerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public Response GetSqlContainerThroughput(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateGetSqlContainerThroughputRequest(resourceGroupName, accountName, databaseName, containerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateSqlContainerThroughputRequest(string resourceGroupName, string accountName, string databaseName, string containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateThroughputParameters); + request.Content = content; + return message; + } + + /// Update RUs per second of an Azure Cosmos DB SQL container. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The parameters to provide for the RUs per second of the current SQL container. + /// The cancellation token to use. + /// , , , , or is null. + public async Task UpdateSqlContainerThroughputAsync(string resourceGroupName, string accountName, string databaseName, string containerName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateSqlContainerThroughputRequest(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update RUs per second of an Azure Cosmos DB SQL container. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The parameters to provide for the RUs per second of the current SQL container. + /// The cancellation token to use. + /// , , , , or is null. + public Response UpdateSqlContainerThroughput(string resourceGroupName, string accountName, string databaseName, string containerName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateSqlContainerThroughputRequest(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateSqlContainerToAutoscaleRequest(string resourceGroupName, string accountName, string databaseName, string containerName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public async Task MigrateSqlContainerToAutoscaleAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateMigrateSqlContainerToAutoscaleRequest(resourceGroupName, accountName, databaseName, containerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public Response MigrateSqlContainerToAutoscale(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateMigrateSqlContainerToAutoscaleRequest(resourceGroupName, accountName, databaseName, containerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateSqlContainerToManualThroughputRequest(string resourceGroupName, string accountName, string databaseName, string containerName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public async Task MigrateSqlContainerToManualThroughputAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateMigrateSqlContainerToManualThroughputRequest(resourceGroupName, accountName, databaseName, containerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public Response MigrateSqlContainerToManualThroughput(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateMigrateSqlContainerToManualThroughputRequest(resourceGroupName, accountName, databaseName, containerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListSqlStoredProceduresRequest(string resourceGroupName, string accountName, string databaseName, string containerName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/storedProcedures", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListSqlStoredProceduresAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateListSqlStoredProceduresRequest(resourceGroupName, accountName, databaseName, containerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlStoredProcedureListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlStoredProcedureListResult.DeserializeSqlStoredProcedureListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public Response ListSqlStoredProcedures(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateListSqlStoredProceduresRequest(resourceGroupName, accountName, databaseName, containerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlStoredProcedureListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlStoredProcedureListResult.DeserializeSqlStoredProcedureListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetSqlStoredProcedureRequest(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/storedProcedures/", false); + uri.AppendPath(storedProcedureName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB storedProcedure name. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> GetSqlStoredProcedureAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (storedProcedureName == null) + { + throw new ArgumentNullException(nameof(storedProcedureName)); + } + + using var message = CreateGetSqlStoredProcedureRequest(resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlStoredProcedureGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlStoredProcedureGetResults.DeserializeSqlStoredProcedureGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB storedProcedure name. + /// The cancellation token to use. + /// , , , , or is null. + public Response GetSqlStoredProcedure(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (storedProcedureName == null) + { + throw new ArgumentNullException(nameof(storedProcedureName)); + } + + using var message = CreateGetSqlStoredProcedureRequest(resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlStoredProcedureGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlStoredProcedureGetResults.DeserializeSqlStoredProcedureGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateSqlStoredProcedureRequest(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName, SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/storedProcedures/", false); + uri.AppendPath(storedProcedureName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateSqlStoredProcedureParameters); + request.Content = content; + return message; + } + + /// Create or update an Azure Cosmos DB SQL storedProcedure. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB storedProcedure name. + /// The parameters to provide for the current SQL storedProcedure. + /// The cancellation token to use. + /// , , , , , or is null. + public async Task CreateUpdateSqlStoredProcedureAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName, SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (storedProcedureName == null) + { + throw new ArgumentNullException(nameof(storedProcedureName)); + } + if (createUpdateSqlStoredProcedureParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlStoredProcedureParameters)); + } + + using var message = CreateCreateUpdateSqlStoredProcedureRequest(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSqlStoredProcedureParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an Azure Cosmos DB SQL storedProcedure. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB storedProcedure name. + /// The parameters to provide for the current SQL storedProcedure. + /// The cancellation token to use. + /// , , , , , or is null. + public Response CreateUpdateSqlStoredProcedure(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName, SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (storedProcedureName == null) + { + throw new ArgumentNullException(nameof(storedProcedureName)); + } + if (createUpdateSqlStoredProcedureParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlStoredProcedureParameters)); + } + + using var message = CreateCreateUpdateSqlStoredProcedureRequest(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSqlStoredProcedureParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteSqlStoredProcedureRequest(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/storedProcedures/", false); + uri.AppendPath(storedProcedureName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB SQL storedProcedure. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB storedProcedure name. + /// The cancellation token to use. + /// , , , , or is null. + public async Task DeleteSqlStoredProcedureAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (storedProcedureName == null) + { + throw new ArgumentNullException(nameof(storedProcedureName)); + } + + using var message = CreateDeleteSqlStoredProcedureRequest(resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + 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 an existing Azure Cosmos DB SQL storedProcedure. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB storedProcedure name. + /// The cancellation token to use. + /// , , , , or is null. + public Response DeleteSqlStoredProcedure(string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (storedProcedureName == null) + { + throw new ArgumentNullException(nameof(storedProcedureName)); + } + + using var message = CreateDeleteSqlStoredProcedureRequest(resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListSqlUserDefinedFunctionsRequest(string resourceGroupName, string accountName, string databaseName, string containerName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/userDefinedFunctions", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListSqlUserDefinedFunctionsAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateListSqlUserDefinedFunctionsRequest(resourceGroupName, accountName, databaseName, containerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlUserDefinedFunctionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlUserDefinedFunctionListResult.DeserializeSqlUserDefinedFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public Response ListSqlUserDefinedFunctions(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateListSqlUserDefinedFunctionsRequest(resourceGroupName, accountName, databaseName, containerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlUserDefinedFunctionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlUserDefinedFunctionListResult.DeserializeSqlUserDefinedFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetSqlUserDefinedFunctionRequest(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/userDefinedFunctions/", false); + uri.AppendPath(userDefinedFunctionName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB userDefinedFunction name. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> GetSqlUserDefinedFunctionAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (userDefinedFunctionName == null) + { + throw new ArgumentNullException(nameof(userDefinedFunctionName)); + } + + using var message = CreateGetSqlUserDefinedFunctionRequest(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlUserDefinedFunctionGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlUserDefinedFunctionGetResults.DeserializeSqlUserDefinedFunctionGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB userDefinedFunction name. + /// The cancellation token to use. + /// , , , , or is null. + public Response GetSqlUserDefinedFunction(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (userDefinedFunctionName == null) + { + throw new ArgumentNullException(nameof(userDefinedFunctionName)); + } + + using var message = CreateGetSqlUserDefinedFunctionRequest(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlUserDefinedFunctionGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlUserDefinedFunctionGetResults.DeserializeSqlUserDefinedFunctionGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateSqlUserDefinedFunctionRequest(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/userDefinedFunctions/", false); + uri.AppendPath(userDefinedFunctionName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateSqlUserDefinedFunctionParameters); + request.Content = content; + return message; + } + + /// Create or update an Azure Cosmos DB SQL userDefinedFunction. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB userDefinedFunction name. + /// The parameters to provide for the current SQL userDefinedFunction. + /// The cancellation token to use. + /// , , , , , or is null. + public async Task CreateUpdateSqlUserDefinedFunctionAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (userDefinedFunctionName == null) + { + throw new ArgumentNullException(nameof(userDefinedFunctionName)); + } + if (createUpdateSqlUserDefinedFunctionParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlUserDefinedFunctionParameters)); + } + + using var message = CreateCreateUpdateSqlUserDefinedFunctionRequest(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an Azure Cosmos DB SQL userDefinedFunction. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB userDefinedFunction name. + /// The parameters to provide for the current SQL userDefinedFunction. + /// The cancellation token to use. + /// , , , , , or is null. + public Response CreateUpdateSqlUserDefinedFunction(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (userDefinedFunctionName == null) + { + throw new ArgumentNullException(nameof(userDefinedFunctionName)); + } + if (createUpdateSqlUserDefinedFunctionParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlUserDefinedFunctionParameters)); + } + + using var message = CreateCreateUpdateSqlUserDefinedFunctionRequest(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteSqlUserDefinedFunctionRequest(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/userDefinedFunctions/", false); + uri.AppendPath(userDefinedFunctionName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB userDefinedFunction name. + /// The cancellation token to use. + /// , , , , or is null. + public async Task DeleteSqlUserDefinedFunctionAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (userDefinedFunctionName == null) + { + throw new ArgumentNullException(nameof(userDefinedFunctionName)); + } + + using var message = CreateDeleteSqlUserDefinedFunctionRequest(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + 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 an existing Azure Cosmos DB SQL userDefinedFunction. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB userDefinedFunction name. + /// The cancellation token to use. + /// , , , , or is null. + public Response DeleteSqlUserDefinedFunction(string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (userDefinedFunctionName == null) + { + throw new ArgumentNullException(nameof(userDefinedFunctionName)); + } + + using var message = CreateDeleteSqlUserDefinedFunctionRequest(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListSqlTriggersRequest(string resourceGroupName, string accountName, string databaseName, string containerName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/triggers", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the SQL trigger under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListSqlTriggersAsync(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateListSqlTriggersRequest(resourceGroupName, accountName, databaseName, containerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlTriggerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlTriggerListResult.DeserializeSqlTriggerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the SQL trigger under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The cancellation token to use. + /// , , , or is null. + public Response ListSqlTriggers(string resourceGroupName, string accountName, string databaseName, string containerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + + using var message = CreateListSqlTriggersRequest(resourceGroupName, accountName, databaseName, containerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlTriggerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlTriggerListResult.DeserializeSqlTriggerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetSqlTriggerRequest(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/triggers/", false); + uri.AppendPath(triggerName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the SQL trigger under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB trigger name. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> GetSqlTriggerAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (triggerName == null) + { + throw new ArgumentNullException(nameof(triggerName)); + } + + using var message = CreateGetSqlTriggerRequest(resourceGroupName, accountName, databaseName, containerName, triggerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlTriggerGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlTriggerGetResults.DeserializeSqlTriggerGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the SQL trigger under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB trigger name. + /// The cancellation token to use. + /// , , , , or is null. + public Response GetSqlTrigger(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (triggerName == null) + { + throw new ArgumentNullException(nameof(triggerName)); + } + + using var message = CreateGetSqlTriggerRequest(resourceGroupName, accountName, databaseName, containerName, triggerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlTriggerGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlTriggerGetResults.DeserializeSqlTriggerGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateSqlTriggerRequest(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/triggers/", false); + uri.AppendPath(triggerName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateSqlTriggerParameters); + request.Content = content; + return message; + } + + /// Create or update an Azure Cosmos DB SQL trigger. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB trigger name. + /// The parameters to provide for the current SQL trigger. + /// The cancellation token to use. + /// , , , , , or is null. + public async Task CreateUpdateSqlTriggerAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (triggerName == null) + { + throw new ArgumentNullException(nameof(triggerName)); + } + if (createUpdateSqlTriggerParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlTriggerParameters)); + } + + using var message = CreateCreateUpdateSqlTriggerRequest(resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an Azure Cosmos DB SQL trigger. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB trigger name. + /// The parameters to provide for the current SQL trigger. + /// The cancellation token to use. + /// , , , , , or is null. + public Response CreateUpdateSqlTrigger(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (triggerName == null) + { + throw new ArgumentNullException(nameof(triggerName)); + } + if (createUpdateSqlTriggerParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlTriggerParameters)); + } + + using var message = CreateCreateUpdateSqlTriggerRequest(resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteSqlTriggerRequest(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/triggers/", false); + uri.AppendPath(triggerName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB SQL trigger. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB trigger name. + /// The cancellation token to use. + /// , , , , or is null. + public async Task DeleteSqlTriggerAsync(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (triggerName == null) + { + throw new ArgumentNullException(nameof(triggerName)); + } + + using var message = CreateDeleteSqlTriggerRequest(resourceGroupName, accountName, databaseName, containerName, triggerName); + 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 an existing Azure Cosmos DB SQL trigger. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// Cosmos DB trigger name. + /// The cancellation token to use. + /// , , , , or is null. + public Response DeleteSqlTrigger(string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (triggerName == null) + { + throw new ArgumentNullException(nameof(triggerName)); + } + + using var message = CreateDeleteSqlTriggerRequest(resourceGroupName, accountName, databaseName, containerName, triggerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesUpdateSqlContainerThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesUpdateSqlContainerThroughputOperation.cs new file mode 100644 index 000000000000..4e97923e0922 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesUpdateSqlContainerThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Update RUs per second of an Azure Cosmos DB SQL container. + public partial class SqlResourcesUpdateSqlContainerThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesUpdateSqlContainerThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesUpdateSqlContainerThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesUpdateSqlDatabaseThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesUpdateSqlDatabaseThroughputOperation.cs new file mode 100644 index 000000000000..1f376dec8e82 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesUpdateSqlDatabaseThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Update RUs per second of an Azure Cosmos DB SQL database. + public partial class SqlResourcesUpdateSqlDatabaseThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal SqlResourcesUpdateSqlDatabaseThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesUpdateSqlDatabaseThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesCreateUpdateTableOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesCreateUpdateTableOperation.cs new file mode 100644 index 000000000000..4b818189067c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesCreateUpdateTableOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update an Azure Cosmos DB Table. + public partial class TableResourcesCreateUpdateTableOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal TableResourcesCreateUpdateTableOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "TableResourcesCreateUpdateTableOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override TableGetResults 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); + + TableGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return TableGetResults.DeserializeTableGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return TableGetResults.DeserializeTableGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesDeleteTableOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesDeleteTableOperation.cs new file mode 100644 index 000000000000..8137a1ba9212 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesDeleteTableOperation.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.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB Table. + public partial class TableResourcesDeleteTableOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal TableResourcesDeleteTableOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "TableResourcesDeleteTableOperation"); + } + /// + 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesMigrateTableToAutoscaleOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesMigrateTableToAutoscaleOperation.cs new file mode 100644 index 000000000000..7737d960fd1c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesMigrateTableToAutoscaleOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + public partial class TableResourcesMigrateTableToAutoscaleOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal TableResourcesMigrateTableToAutoscaleOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "TableResourcesMigrateTableToAutoscaleOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesMigrateTableToManualThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesMigrateTableToManualThroughputOperation.cs new file mode 100644 index 000000000000..964801e393ac --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesMigrateTableToManualThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + public partial class TableResourcesMigrateTableToManualThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal TableResourcesMigrateTableToManualThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "TableResourcesMigrateTableToManualThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesOperations.cs new file mode 100644 index 000000000000..c04c944a7901 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesOperations.cs @@ -0,0 +1,558 @@ +// 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.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The TableResources service client. + public partial class TableResourcesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal TableResourcesRestOperations RestClient { get; } + /// Initializes a new instance of TableResourcesOperations for mocking. + protected TableResourcesOperations() + { + } + /// Initializes a new instance of TableResourcesOperations. + /// 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 TableResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new TableResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + public virtual async Task> GetTableAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.GetTable"); + scope.Start(); + try + { + return await RestClient.GetTableAsync(resourceGroupName, accountName, tableName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + public virtual Response GetTable(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.GetTable"); + scope.Start(); + try + { + return RestClient.GetTable(resourceGroupName, accountName, tableName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + public virtual async Task> GetTableThroughputAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.GetTableThroughput"); + scope.Start(); + try + { + return await RestClient.GetTableThroughputAsync(resourceGroupName, accountName, tableName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + public virtual Response GetTableThroughput(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.GetTableThroughput"); + scope.Start(); + try + { + return RestClient.GetTableThroughput(resourceGroupName, accountName, tableName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the Tables under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListTablesAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.ListTables"); + scope.Start(); + try + { + var response = await RestClient.ListTablesAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the Tables under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListTables(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.ListTables"); + scope.Start(); + try + { + var response = RestClient.ListTables(resourceGroupName, accountName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Create or update an Azure Cosmos DB Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The parameters to provide for the current Table. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateUpdateTableAsync(string resourceGroupName, string accountName, string tableName, TableCreateUpdateParameters createUpdateTableParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (createUpdateTableParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateTableParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.StartCreateUpdateTable"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateTableAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters, cancellationToken).ConfigureAwait(false); + return new TableResourcesCreateUpdateTableOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateTableRequest(resourceGroupName, accountName, tableName, createUpdateTableParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The parameters to provide for the current Table. + /// The cancellation token to use. + /// , , , or is null. + public virtual TableResourcesCreateUpdateTableOperation StartCreateUpdateTable(string resourceGroupName, string accountName, string tableName, TableCreateUpdateParameters createUpdateTableParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (createUpdateTableParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateTableParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.StartCreateUpdateTable"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateTable(resourceGroupName, accountName, tableName, createUpdateTableParameters, cancellationToken); + return new TableResourcesCreateUpdateTableOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateTableRequest(resourceGroupName, accountName, tableName, createUpdateTableParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteTableAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.StartDeleteTable"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteTableAsync(resourceGroupName, accountName, tableName, cancellationToken).ConfigureAwait(false); + return new TableResourcesDeleteTableOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteTableRequest(resourceGroupName, accountName, tableName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public virtual TableResourcesDeleteTableOperation StartDeleteTable(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.StartDeleteTable"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteTable(resourceGroupName, accountName, tableName, cancellationToken); + return new TableResourcesDeleteTableOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteTableRequest(resourceGroupName, accountName, tableName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The parameters to provide for the RUs per second of the current Table. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartUpdateTableThroughputAsync(string resourceGroupName, string accountName, string tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.StartUpdateTableThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateTableThroughputAsync(resourceGroupName, accountName, tableName, updateThroughputParameters, cancellationToken).ConfigureAwait(false); + return new TableResourcesUpdateTableThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateTableThroughputRequest(resourceGroupName, accountName, tableName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The parameters to provide for the RUs per second of the current Table. + /// The cancellation token to use. + /// , , , or is null. + public virtual TableResourcesUpdateTableThroughputOperation StartUpdateTableThroughput(string resourceGroupName, string accountName, string tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.StartUpdateTableThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.UpdateTableThroughput(resourceGroupName, accountName, tableName, updateThroughputParameters, cancellationToken); + return new TableResourcesUpdateTableThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateTableThroughputRequest(resourceGroupName, accountName, tableName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartMigrateTableToAutoscaleAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.StartMigrateTableToAutoscale"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateTableToAutoscaleAsync(resourceGroupName, accountName, tableName, cancellationToken).ConfigureAwait(false); + return new TableResourcesMigrateTableToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateTableToAutoscaleRequest(resourceGroupName, accountName, tableName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public virtual TableResourcesMigrateTableToAutoscaleOperation StartMigrateTableToAutoscale(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.StartMigrateTableToAutoscale"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateTableToAutoscale(resourceGroupName, accountName, tableName, cancellationToken); + return new TableResourcesMigrateTableToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateTableToAutoscaleRequest(resourceGroupName, accountName, tableName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartMigrateTableToManualThroughputAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.StartMigrateTableToManualThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateTableToManualThroughputAsync(resourceGroupName, accountName, tableName, cancellationToken).ConfigureAwait(false); + return new TableResourcesMigrateTableToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateTableToManualThroughputRequest(resourceGroupName, accountName, tableName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public virtual TableResourcesMigrateTableToManualThroughputOperation StartMigrateTableToManualThroughput(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var scope = _clientDiagnostics.CreateScope("TableResourcesOperations.StartMigrateTableToManualThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateTableToManualThroughput(resourceGroupName, accountName, tableName, cancellationToken); + return new TableResourcesMigrateTableToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateTableToManualThroughputRequest(resourceGroupName, accountName, tableName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesRestOperations.cs new file mode 100644 index 000000000000..bce9a836d5bd --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesRestOperations.cs @@ -0,0 +1,779 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class TableResourcesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of TableResourcesRestOperations. + /// 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. + /// is null. + public TableResourcesRestOperations(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 HttpMessage CreateListTablesRequest(string resourceGroupName, string accountName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/tables", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Lists the Tables under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListTablesAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListTablesRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TableListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TableListResult.DeserializeTableListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the Tables under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListTables(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListTablesRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TableListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TableListResult.DeserializeTableListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetTableRequest(string resourceGroupName, string accountName, string tableName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetTableAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateGetTableRequest(resourceGroupName, accountName, tableName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TableGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TableGetResults.DeserializeTableGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public Response GetTable(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateGetTableRequest(resourceGroupName, accountName, tableName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TableGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TableGetResults.DeserializeTableGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateTableRequest(string resourceGroupName, string accountName, string tableName, TableCreateUpdateParameters createUpdateTableParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateTableParameters); + request.Content = content; + return message; + } + + /// Create or update an Azure Cosmos DB Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The parameters to provide for the current Table. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateUpdateTableAsync(string resourceGroupName, string accountName, string tableName, TableCreateUpdateParameters createUpdateTableParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (createUpdateTableParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateTableParameters)); + } + + using var message = CreateCreateUpdateTableRequest(resourceGroupName, accountName, tableName, createUpdateTableParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an Azure Cosmos DB Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The parameters to provide for the current Table. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateUpdateTable(string resourceGroupName, string accountName, string tableName, TableCreateUpdateParameters createUpdateTableParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (createUpdateTableParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateTableParameters)); + } + + using var message = CreateCreateUpdateTableRequest(resourceGroupName, accountName, tableName, createUpdateTableParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteTableRequest(string resourceGroupName, string accountName, string tableName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteTableAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateDeleteTableRequest(resourceGroupName, accountName, tableName); + 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 an existing Azure Cosmos DB Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public Response DeleteTable(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateDeleteTableRequest(resourceGroupName, accountName, tableName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetTableThroughputRequest(string resourceGroupName, string accountName, string tableName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetTableThroughputAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateGetTableThroughputRequest(resourceGroupName, accountName, tableName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public Response GetTableThroughput(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateGetTableThroughputRequest(resourceGroupName, accountName, tableName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateTableThroughputRequest(string resourceGroupName, string accountName, string tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateThroughputParameters); + request.Content = content; + return message; + } + + /// Update RUs per second of an Azure Cosmos DB Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The parameters to provide for the RUs per second of the current Table. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateTableThroughputAsync(string resourceGroupName, string accountName, string tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateTableThroughputRequest(resourceGroupName, accountName, tableName, updateThroughputParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update RUs per second of an Azure Cosmos DB Table. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The parameters to provide for the RUs per second of the current Table. + /// The cancellation token to use. + /// , , , or is null. + public Response UpdateTableThroughput(string resourceGroupName, string accountName, string tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateTableThroughputRequest(resourceGroupName, accountName, tableName, updateThroughputParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateTableToAutoscaleRequest(string resourceGroupName, string accountName, string tableName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public async Task MigrateTableToAutoscaleAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateMigrateTableToAutoscaleRequest(resourceGroupName, accountName, tableName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public Response MigrateTableToAutoscale(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateMigrateTableToAutoscaleRequest(resourceGroupName, accountName, tableName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateTableToManualThroughputRequest(string resourceGroupName, string accountName, string tableName) + { + 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.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); + uri.AppendQuery("api-version", "2020-04-01", true); + request.Uri = uri; + return message; + } + + /// Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public async Task MigrateTableToManualThroughputAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateMigrateTableToManualThroughputRequest(resourceGroupName, accountName, tableName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB table name. + /// The cancellation token to use. + /// , , or is null. + public Response MigrateTableToManualThroughput(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateMigrateTableToManualThroughputRequest(resourceGroupName, accountName, tableName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesUpdateTableThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesUpdateTableThroughputOperation.cs new file mode 100644 index 000000000000..03c852b8198c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesUpdateTableThroughputOperation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Update RUs per second of an Azure Cosmos DB Table. + public partial class TableResourcesUpdateTableThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + internal TableResourcesUpdateTableThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "TableResourcesUpdateTableThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults 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); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Properties/AssemblyInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..9f1fb63c0d1d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Properties/AssemblyInfo.cs @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.DocumentDB")] + +[assembly: InternalsVisibleTo("Azure.ResourceManager.CosmosDB.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md new file mode 100644 index 000000000000..d560d4242908 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md @@ -0,0 +1,12 @@ +# Generated code configuration + +Run `dotnet msbuild /t:GenerateCode` to generate code. + +``` yaml + +azure-arm: true +require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/86f4c7c4403845651ab9c027f7aa6fa392fd935c/specification/cosmos-db/resource-manager/readme.md +modelerfour: + lenient-model-deduplication: true + +``` \ No newline at end of file diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/Azure.ResourceManager.CosmosDB.Tests.csproj b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/Azure.ResourceManager.CosmosDB.Tests.csproj new file mode 100644 index 000000000000..e50ce2edc433 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/Azure.ResourceManager.CosmosDB.Tests.csproj @@ -0,0 +1,9 @@ + + + Resources201705; + + + + + + diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/CosmosDBManagementClientBase.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/CosmosDBManagementClientBase.cs new file mode 100644 index 000000000000..1a63d21df672 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/CosmosDBManagementClientBase.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; +using Azure.Management.Resources; +using Azure.ResourceManager.TestFramework; + +namespace Azure.ResourceManager.CosmosDB.Tests +{ + [RunFrequency(RunTestFrequency.Manually)] + public abstract class CosmosDBManagementClientBase : ManagementRecordedTestBase + { + public string SubscriptionId { get; set; } + public ResourcesManagementClient ResourcesManagementClient { get; set; } + public ResourceGroupsOperations ResourceGroupsOperations { get; set; } + public CosmosDBManagementClient CosmosDBManagementClient { get; set; } + + protected CosmosDBManagementClientBase(bool isAsync) + : base(isAsync) + { + } + + protected void InitializeClients() + { + SubscriptionId = TestEnvironment.SubscriptionId; + ResourcesManagementClient = GetResourceManagementClient(); + ResourceGroupsOperations = ResourcesManagementClient.ResourceGroups; + CosmosDBManagementClient = GetCosmosDBManagementClient(); + } + + internal CosmosDBManagementClient GetCosmosDBManagementClient() + { + return CreateClient(this.SubscriptionId, + TestEnvironment.Credential, + Recording.InstrumentClientOptions(new CosmosDBManagementClientOptions())); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/CosmosDBManagementTestEnvironment.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/CosmosDBManagementTestEnvironment.cs new file mode 100644 index 000000000000..87907e017972 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/CosmosDBManagementTestEnvironment.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.CosmosDB.Tests +{ + public class CosmosDBManagementTestEnvironment : TestEnvironment + { + public CosmosDBManagementTestEnvironment() : base("cosmosdb") + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/Helpers/CosmosDBTestUtilities.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/Helpers/CosmosDBTestUtilities.cs new file mode 100644 index 000000000000..6ae70e93438d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/Helpers/CosmosDBTestUtilities.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Management.Resources; +using Azure.Management.Resources.Models; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.CosmosDB.Tests +{ + public static class CosmosDBTestUtilities + { + internal const string ResourceGroupPrefix = "DefaultCosmosDB"; + internal const string Location = "West US"; + public static async Task TryRegisterResourceGroupAsync(ResourceGroupsOperations resourceGroupsOperations, string location, string resourceGroupName) + { + await resourceGroupsOperations.CreateOrUpdateAsync(resourceGroupName, new ResourceGroup(location)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/Properties/AssemblyInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..1a146b709b0b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.DocumentDB")] diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/OperationsTest.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/OperationsTest.cs new file mode 100644 index 000000000000..1be05014f329 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/OperationsTest.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; +using NUnit.Framework; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.CosmosDB.Tests +{ + [TestFixture] + public class OperationsTest : CosmosDBManagementClientBase + { + public OperationsTest() + : base(true) + { + } + + [SetUp] + public async Task ClearAndInitialize() + { + if (Mode == RecordedTestMode.Record || Mode == RecordedTestMode.Playback) + { + InitializeClients(); + await CosmosDBTestUtilities.TryRegisterResourceGroupAsync(ResourceGroupsOperations, + CosmosDBTestUtilities.Location, + Recording.GenerateAssetName(CosmosDBTestUtilities.ResourceGroupPrefix)); + } + } + + [TearDown] + public async Task CleanupResourceGroup() + { + await CleanupResourceGroupsAsync(); + } + + [TestCase] + public async Task ListOperationsTest() + { + var cosmosDBClient = GetCosmosDBManagementClient(); + var operations = cosmosDBClient.Operations.ListAsync(); + Assert.NotNull(operations); + Assert.IsNotEmpty(await operations.ToEnumerableAsync()); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/SessionRecords/OperationsTest/ListOperationsTest()Async.json b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/SessionRecords/OperationsTest/ListOperationsTest()Async.json new file mode 100644 index 000000000000..24eef7bc27ae --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/SessionRecords/OperationsTest/ListOperationsTest()Async.json @@ -0,0 +1,5836 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourcegroups/DefaultCosmosDB5382?api-version=2017-05-10", + "RequestMethod": "PUT", + "RequestHeaders": { + "Authorization": "Sanitized", + "Content-Length": "22", + "Content-Type": "application/json", + "traceparent": "00-ad6203b40933524d982ce3edc25be239-1c86bab05fe80547-00", + "User-Agent": [ + "azsdk-net-ResourceManager.CosmosDB.Tests/1.0.0-dev.20200824.1", + "(.NET Core 4.6.29130.01; Microsoft Windows 10.0.19041 )" + ], + "x-ms-client-request-id": "9d79404b4d31445c241cc7a3e5326c24", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "location": "West US" + }, + "StatusCode": 201, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "191", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 25 Aug 2020 01:03:52 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "2affb5b4-811b-4022-84a2-ac55c2f4341f", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-request-id": "2affb5b4-811b-4022-84a2-ac55c2f4341f", + "x-ms-routing-request-id": "WESTUS:20200825T010352Z:2affb5b4-811b-4022-84a2-ac55c2f4341f" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/DefaultCosmosDB5382", + "name": "DefaultCosmosDB5382", + "location": "westus", + "properties": { + "provisioningState": "Succeeded" + } + } + }, + { + "RequestUri": "https://management.azure.com/providers/Microsoft.DocumentDB/operations?api-version=2020-04-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Authorization": "Sanitized", + "User-Agent": [ + "azsdk-net-ResourceManager.CosmosDB/1.0.0-dev.20200824.1", + "(.NET Core 4.6.29130.01; Microsoft Windows 10.0.19041 )" + ], + "x-ms-client-request-id": "652e9c25633df7637b797f8821b4c914", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "Content-Length": "137157", + "Content-Location": "https://management.documents.azure.com:450/providers/Microsoft.DocumentDB/operations?api-version=2020-04-01", + "Content-Type": "application/json", + "Date": "Tue, 25 Aug 2020 01:03:53 GMT", + "Pragma": "no-cache", + "Server": "Microsoft-HTTPAPI/2.0", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "20e392f0-4f93-484b-8ea8-806b3f7087c2", + "x-ms-gatewayversion": "version=2.11.0", + "x-ms-ratelimit-remaining-tenant-reads": "11999", + "x-ms-request-id": "20e392f0-4f93-484b-8ea8-806b3f7087c2", + "x-ms-routing-request-id": "WESTUS:20200825T010354Z:20e392f0-4f93-484b-8ea8-806b3f7087c2" + }, + "ResponseBody": { + "value": [ + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Database", + "Operation": "Write SQL database", + "Description": "Create a SQL database." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Database", + "Operation": "Read SQL database(s)", + "Description": "Read a SQL database or list all the SQL databases." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Database", + "Operation": "Delete SQL database", + "Description": "Delete a SQL database." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Database", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Container", + "Operation": "Write SQL container", + "Description": "Create or update a SQL container." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Container", + "Operation": "Read SQL container(s)", + "Description": "Read a SQL container or list all the SQL containers." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Container", + "Operation": "Delete SQL container", + "Description": "Delete a SQL container." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Container", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/storedProcedures/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Stored Procedure", + "Operation": "Write SQL stored procedure", + "Description": "Create or update a SQL stored procedure." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/storedProcedures/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Stored Procedure", + "Operation": "Read SQL stored procedure(s)", + "Description": "Read a SQL stored procedure or list all the SQL stored procedures." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/storedProcedures/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Stored Procedure", + "Operation": "Delete SQL stored procedure", + "Description": "Delete a SQL stored procedure." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/storedProcedures/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Stored Procedure", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/userDefinedFunctions/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL User Defined Function", + "Operation": "Write SQL user defined function", + "Description": "Create or update a SQL user defined function." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/userDefinedFunctions/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL User Defined Function", + "Operation": "Read SQL user defined function(s)", + "Description": "Read a SQL user defined function or list all the SQL user defined functions." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/userDefinedFunctions/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL User Defined Function", + "Operation": "Delete SQL user defined function", + "Description": "Delete a SQL user defined function." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/userDefinedFunctions/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL User Defined Function", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Tirgger", + "Operation": "Write SQL trigger", + "Description": "Create or update a SQL trigger." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Tirgger", + "Operation": "Read SQL trigger(s)", + "Description": "Read a SQL trigger or list all the SQL triggers." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Tirgger", + "Operation": "Delete SQL trigger", + "Description": "Delete a SQL trigger." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Tirgger", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/tables/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table", + "Operation": "Write table", + "Description": "Create or update a table." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/tables/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table", + "Operation": "Read table(s)", + "Description": "Read a table or list all the tables." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/tables/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table", + "Operation": "Delete table", + "Description": "Delete a table." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/tables/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Database", + "Operation": "Write MongoDB database", + "Description": "Create a MongoDB database." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Database", + "Operation": "Read MongoDB database(s)", + "Description": "Read a MongoDB database or list all the MongoDB databases." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Database", + "Operation": "Delete MongoDB database", + "Description": "Delete a MongoDB database." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Database", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Collection", + "Operation": "Write MongoDB collection", + "Description": "Create or update a MongoDB collection." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Collection", + "Operation": "Read MongoDB collection(s)", + "Description": "Read a MongoDB collection or list all the MongoDB collections." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Collection", + "Operation": "Delete MongoDB collection", + "Description": "Delete a MongoDB collection." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Collection", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Keyspace", + "Operation": "Write Cassandra keyspace", + "Description": "Create a Cassandra keyspace." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Keyspace", + "Operation": "Read Cassandra keyspace(s)", + "Description": "Read a Cassandra keyspace or list all the Cassandra keyspaces." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Keyspace", + "Operation": "Delete Cassandra keyspace", + "Description": "Delete a Cassandra keyspace." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Keyspace", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/tables/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Table", + "Operation": "Write Cassandra table", + "Description": "Create or update a Cassandra table." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/tables/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Table", + "Operation": "Read Cassandra table(s)", + "Description": "Read a Cassandra table or list all the Cassandra tables." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/tables/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Table", + "Operation": "Delete Cassandra table", + "Description": "Delete a Cassandra table." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/tables/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Table", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Database", + "Operation": "Write Gremlin database", + "Description": "Create a Gremlin database." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Database", + "Operation": "Read Gremlin database(s)", + "Description": "Read a Gremlin database or list all the Gremlin databases." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Database", + "Operation": "Delete Gremlin database", + "Description": "Delete a Gremlin database." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Database", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Graph", + "Operation": "Write Gremlin graph", + "Description": "Create or update a Gremlin graph." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Graph", + "Operation": "Read Gremlin graph(s)", + "Description": "Read a Gremlin graph or list all the Gremlin graphs." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Graph", + "Operation": "Delete Gremlin graph", + "Description": "Delete a Gremlin graph." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Graph", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/throughputSettings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Database throughput setting", + "Operation": "Write SQL database throughput", + "Description": "Update a SQL database throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/throughputSettings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Database throughput setting", + "Operation": "Read SQL database throughput", + "Description": "Read a SQL database throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/throughputSettings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Database throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/throughputSettings/migrateToAutoscale/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Database throughput setting", + "Operation": "Migrate SQL database offer to autoscale", + "Description": "Migrate SQL database offer to autoscale." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/throughputSettings/migrateToManualThroughput/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Database throughput setting", + "Operation": "Migrate a SQL database throughput offer to manual throughput", + "Description": "Migrate a SQL database throughput offer to manual throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/throughputSettings/migrateToAutoscale/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Database throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/throughputSettings/migrateToManualThroughput/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Database throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/throughputSettings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Container throughput setting", + "Operation": "Write SQL container throughput", + "Description": "Update a SQL container throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/throughputSettings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Container throughput setting", + "Operation": "Read SQL container throughput", + "Description": "Read a SQL container throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/throughputSettings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Container throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/throughputSettings/migrateToAutoscale/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Container throughput setting", + "Operation": "Migrate SQL container offer to autoscale", + "Description": "Migrate SQL container offer to autoscale." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/throughputSettings/migrateToManualThroughput/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Container throughput setting", + "Operation": "Migrate a SQL database throughput offer to manual throughput", + "Description": "Migrate a SQL database throughput offer to manual throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/throughputSettings/migrateToAutoscale/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Container throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/throughputSettings/migrateToManualThroughput/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "SQL Container throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/tables/throughputSettings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table throughput setting", + "Operation": "Write table throughput", + "Description": "Update a table throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/tables/throughputSettings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table throughput setting", + "Operation": "Read table throughput", + "Description": "Read a table throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/tables/throughputSettings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/tables/throughputSettings/migrateToAutoscale/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table throughput setting", + "Operation": "Migrate table offer to autoscale", + "Description": "Migrate table offer to autoscale." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/tables/throughputSettings/migrateToManualThroughput/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table throughput setting", + "Operation": "Migrate table offer to to manual throughput", + "Description": "Migrate table offer to to manual throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/tables/throughputSettings/migrateToAutoscale/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/tables/throughputSettings/migrateToManualThroughput/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Database throughput setting", + "Operation": "Write MongoDB database throughput", + "Description": "Update a MongoDB database throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Database throughput setting", + "Operation": "Read MongoDB database throughput", + "Description": "Read a MongoDB database throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Database throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/migrateToAutoscale/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Database throughput setting", + "Operation": "Migrate MongoDB database offer to autoscale", + "Description": "Migrate MongoDB database offer to autoscale." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/migrateToManualThroughput/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Database throughput setting", + "Operation": "Migrate MongoDB database offer to to manual throughput", + "Description": "Migrate MongoDB database offer to to manual throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/migrateToAutoscale/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Database throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/migrateToManualThroughput/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Database throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Collection throughput setting", + "Operation": "Write MongoDB collection throughput", + "Description": "Update a MongoDB collection throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Collection throughput setting", + "Operation": "Read MongoDB collection throughput", + "Description": "Read a MongoDB collection throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB Collection throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/migrateToAutoscale/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB collection throughput setting", + "Operation": "Migrate MongoDB collection offer to autoscale", + "Description": "Migrate MongoDB collection offer to autoscale." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/migrateToManualThroughput/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB collection throughput setting", + "Operation": "Migrate MongoDB collection offer to to manual throughput", + "Description": "Migrate MongoDB collection offer to to manual throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/migrateToAutoscale/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB collection throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/migrateToManualThroughput/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "MongoDB collection throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/throughputSettings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Keyspace throughput setting", + "Operation": "Write Cassandra keyspace throughput", + "Description": "Update a Cassandra keyspace throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/throughputSettings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Keyspace throughput setting", + "Operation": "Read Cassandra keyspace throughput", + "Description": "Read a Cassandra keyspace throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/throughputSettings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Keyspace throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/throughputSettings/migrateToAutoscale/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra keyspace throughput setting", + "Operation": "Migrate Cassandra keyspace offer to autoscale", + "Description": "Migrate Cassandra keyspace offer to autoscale." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/throughputSettings/migrateToManualThroughput/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra keyspace throughput setting", + "Operation": "Migrate Cassandra keyspace offer to to manual throughput", + "Description": "Migrate Cassandra keyspace offer to to manual throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/throughputSettings/migrateToAutoscale/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra keyspace throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/throughputSettings/migrateToManualThroughput/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra keyspace throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/tables/throughputSettings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Table throughput setting", + "Operation": "Write Cassandra table throughput", + "Description": "Update a Cassandra table throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/tables/throughputSettings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Table throughput setting", + "Operation": "Read Cassandra table throughput", + "Description": "Read a Cassandra table throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/tables/throughputSettings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra Table throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/tables/throughputSettings/migrateToAutoscale/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra table throughput setting", + "Operation": "Migrate Cassandra table offer to autoscale", + "Description": "Migrate Cassandra table offer to autoscale." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/tables/throughputSettings/migrateToManualThroughput/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra table throughput setting", + "Operation": "Migrate Cassandra table offer to to manual throughput", + "Description": "Migrate Cassandra table offer to to manual throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/tables/throughputSettings/migrateToAutoscale/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra table throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/tables/throughputSettings/migrateToManualThroughput/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Cassandra table throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/throughputSettings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Database throughput setting", + "Operation": "Write Gremlin database throughput", + "Description": "Update a Gremlin database throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/throughputSettings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Database throughput setting", + "Operation": "Read Gremlin database throughput", + "Description": "Read a Gremlin database throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/throughputSettings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Database throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/throughputSettings/migrateToAutoscale/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Database throughput setting", + "Operation": "Migrate Gremlin Database offer to autoscale", + "Description": "Migrate Gremlin Database offer to autoscale." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/throughputSettings/migrateToManualThroughput/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Database throughput setting", + "Operation": "Migrate Gremlin Database offer to to manual throughput", + "Description": "Migrate Gremlin Database offer to to manual throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/throughputSettings/migrateToAutoscale/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Database throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/throughputSettings/migrateToManualThroughput/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Database throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/throughputSettings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Graph throughput setting", + "Operation": "Write Gremlin graph throughput", + "Description": "Update a Gremlin graph throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/throughputSettings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Graph throughput setting", + "Operation": "Read Gremlin graph throughput", + "Description": "Read a Gremlin graph throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/throughputSettings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin Graph throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/throughputSettings/migrateToAutoscale/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin graph throughput setting", + "Operation": "Migrate Gremlin graph offer to autoscale", + "Description": "Migrate Gremlin graph offer to autoscale." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/throughputSettings/migrateToManualThroughput/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin graph throughput setting", + "Operation": "Migrate Gremlin graph offer to to manual throughput", + "Description": "Migrate Gremlin graph offer to to manual throughput." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/throughputSettings/migrateToAutoscale/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin graph throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/throughputSettings/migrateToManualThroughput/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Gremlin graph throughput setting", + "Operation": "Read operation results", + "Description": "Read status of the asynchronous operation." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write database", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Create a database. Only applicable to API types: \u0027sql\u0027, \u0027mongodb\u0027, \u0027gremlin\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read database(s)", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a database or list all the databases. Only applicable to API types: \u0027sql\u0027, \u0027mongodb\u0027, \u0027gremlin\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete database", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete a database. Only applicable to API types: \u0027sql\u0027, \u0027mongodb\u0027, \u0027gremlin\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027sql\u0027, \u0027mongodb\u0027, \u0027gremlin\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/containers/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Container", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write container", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Create or update a container. Only applicable to API types: \u0027sql\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/containers/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Container", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read container(s)", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a container or list all the containers. Only applicable to API types: \u0027sql\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/containers/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Container", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete container", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete a container. Only applicable to API types: \u0027sql\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/containers/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Container", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027sql\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/tables/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write table", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Create or update a table. Only applicable to API types: \u0027table\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/tables/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read table(s)", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a table or list all the tables. Only applicable to API types: \u0027table\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/tables/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete table", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete a table. Only applicable to API types: \u0027table\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/tables/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027table\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/collections/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Collection", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write collection", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Create or update a collection. Only applicable to API types: \u0027mongodb\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/collections/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Collection", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read collection(s)", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a collection or list all the collections. Only applicable to API types: \u0027mongodb\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/collections/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Collection", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete collection", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete a collection. Only applicable to API types: \u0027mongodb\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/collections/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Collection", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027mongodb\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Keyspace", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write keyspace", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Create a keyspace. Only applicable to API types: \u0027cassandra\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Keyspace", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read keyspace(s)", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a keyspace or list all the keyspaces. Only applicable to API types: \u0027cassandra\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Keyspace", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete keyspace", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete a keyspace. Only applicable to API types: \u0027cassandra\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Keyspace", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027cassandra\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/tables/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write table", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Create or update a table. Only applicable to API types: \u0027cassandra\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/tables/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read table(s)", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a table or list all the tables. Only applicable to API types: \u0027cassandra\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/tables/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete table", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete a table. Only applicable to API types: \u0027cassandra\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/tables/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027cassandra\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/graphs/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Graph", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write graph", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Create or update a graph. Only applicable to API types: \u0027gremlin\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/graphs/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Graph", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read graph(s)", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a graph or list all the graphs. Only applicable to API types: \u0027gremlin\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/graphs/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Graph", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete graph", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Delete a graph. Only applicable to API types: \u0027gremlin\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/graphs/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Graph", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027gremlin\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/settings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write database throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Update a database throughput. Only applicable to API types: \u0027sql\u0027, \u0027mongodb\u0027, \u0027gremlin\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/settings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read database throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a database throughput. Only applicable to API types: \u0027sql\u0027, \u0027mongodb\u0027, \u0027gremlin\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/settings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027sql\u0027, \u0027mongodb\u0027, \u0027gremlin\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/containers/settings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Container throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write container throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Update a container throughput. Only applicable to API types: \u0027sql\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/containers/settings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Container throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read container throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a container throughput. Only applicable to API types: \u0027sql\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/containers/settings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Container throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027sql\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/tables/settings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write table throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Update a table throughput. Only applicable to API types: \u0027table\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/tables/settings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read table throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a table throughput. Only applicable to API types: \u0027table\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/tables/settings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027table\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/collections/settings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Collection throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write collection throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Update a collection throughput. Only applicable to API types: \u0027mongodb\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/collections/settings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Collection throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read collection throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a collection throughput. Only applicable to API types: \u0027mongodb\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/collections/settings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Collection throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027mongodb\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/settings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Keyspace throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write keyspace throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Update a keyspace throughput. Only applicable to API types: \u0027cassandra\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/settings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Keyspace throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read keyspace throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a keyspace throughput. Only applicable to API types: \u0027cassandra\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/settings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Keyspace throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027cassandra\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/tables/settings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write table throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Update a table throughput. Only applicable to API types: \u0027cassandra\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/tables/settings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read table throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a table throughput. Only applicable to API types: \u0027cassandra\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/keyspaces/tables/settings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Table throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027cassandra\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/graphs/settings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Graph throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Write gremlin throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Update a graph throughput. Only applicable to API types: \u0027gremlin\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/graphs/settings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Graph throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read graph throughput", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read a graph throughput. Only applicable to API types: \u0027gremlin\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/apis/databases/graphs/settings/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Graph throughput setting", + "Operation": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read operation results", + "Description": "(Deprecated. Please use resource paths without \u0027/apis/\u0027 segment) Read status of the asynchronous operation. Only applicable to API types: \u0027gremlin\u0027. Only applicable for setting types: \u0027throughput\u0027." + } + }, + { + "name": "Microsoft.DocumentDB/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Operation Result", + "Operation": "Read operation status", + "Description": "Read status of the asynchronous operation" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccountNames/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account Names", + "Operation": "Read database account names", + "Description": "Checks for name availability." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Read database account", + "Description": "Reads a database account." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Update database account", + "Description": "Update a database accounts." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/listKeys/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "List keys", + "Description": "List keys of a database account" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/readonlykeys/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account readonly keys", + "Operation": "Read database account readonly keys", + "Description": "Reads the database account readonly keys." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/readonlykeys/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account readonly keys", + "Operation": "Read database account readonly keys", + "Description": "Reads the database account readonly keys." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/regenerateKey/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Rotate keys", + "Description": "Rotate keys of a database account" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/listConnectionStrings/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Get Connection Strings", + "Description": "Get the connection strings for a database account" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/changeResourceGroup/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Change resource group", + "Description": "Change resource group of a database account" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/failoverPriorityChange/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Manual Failover", + "Description": "Change failover priorities of regions of a database account. This is used to perform manual failover operation" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/offlineRegion/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Offline Region", + "Description": "Offline a region of a database account. " + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/onlineRegion/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Online Region", + "Description": "Online a region of a database account." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Delete database accounts", + "Description": "Deletes the database accounts." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Read operation status", + "Description": "Read status of the asynchronous operation" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/percentile/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account latencies", + "Operation": "Read latency percentiles", + "Description": "Read percentiles of replication latencies" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/percentile/metrics/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account metrics", + "Operation": "Read latency metrics", + "Description": "Read latency metrics" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/percentile/targetRegion/metrics/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account metrics for a specific target region", + "Operation": "Read latency metricsfor a specific target region", + "Description": "Read latency metrics for a specific target region" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/percentile/sourceRegion/targetRegion/metrics/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account metrics for a specific source and target region", + "Operation": "Read latency metrics for a specific source and target region", + "Description": "Read latency metrics for a specific source and target region" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/databases/collections/partitions/usages/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account partition usages", + "Operation": "Read database account partition level usages", + "Description": "Read database account partition level usages" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/getBackupPolicy/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database", + "Operation": "Get BackupPolicy", + "Description": "Get the backup policy of database account" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/metricDefinitions/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account metric definitions", + "Operation": "Read database account metrics definitions", + "Description": "Reads the database account metrics definitions." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/metrics/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account metrics", + "Operation": "Read database account metrics", + "Description": "Reads the database account metrics." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/usages/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account usages", + "Operation": "Read database account usages", + "Description": "Reads the database account usages." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/databases/metricDefinitions/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database metric definitions", + "Operation": "Read database metric definitions", + "Description": "Reads the database metric definitions" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/databases/metrics/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database metrics", + "Operation": "Read database metrics", + "Description": "Reads the database metrics." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/databases/usages/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database usages", + "Operation": "Read database usages", + "Description": "Reads the database usages." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/databases/collections/metricDefinitions/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Collection metric definitions", + "Operation": "Read collection metric definitions", + "Description": "Reads the collection metric definitions." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/databases/collections/metrics/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Collection metrics", + "Operation": "Read collection metrics", + "Description": "Reads the collection metrics." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/databases/collections/usages/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Collection usages", + "Operation": "Read collection usages", + "Description": "Reads the collection usages." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/region/metrics/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account and Region metrics", + "Operation": "Read region database account metrics", + "Description": "Reads the region and database account metrics." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/region/databases/collections/metrics/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Regional Collection metrics", + "Operation": "Read regional collection metrics", + "Description": "Reads the regional collection metrics." + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/region/databases/collections/partitions/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Regional Database Account Collection partitions", + "Operation": "Read regional database account partitions in a collection", + "Description": "Read regional database account partitions in a collection" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/databases/collections/partitions/metrics/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account partition metrics", + "Operation": "Read database account partition level metrics", + "Description": "Read database account partition level metrics" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/region/databases/collections/partitions/metrics/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Regional Database Account partition metrics", + "Operation": "Read regional database account partition level metrics", + "Description": "Read regional database account partition level metrics" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/region/databases/collections/partitionKeyRangeId/metrics/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Regional Database Account partition key metrics", + "Operation": "Read regional database account partition key level metrics", + "Description": "Read regional database account partition key level metrics" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/databases/collections/partitionKeyRangeId/metrics/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account partition key metrics", + "Operation": "Read database account partition key level metrics", + "Description": "Read database account partition key level metrics" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/databases/collections/partitions/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account Collection partitions", + "Operation": "Read database account partitions in a collection", + "Description": "Read database account partitions in a collection" + } + }, + { + "name": "Microsoft.DocumentDB/register/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "", + "Operation": "Register Microsoft DocumentDB resource provider", + "Description": " Register the Microsoft DocumentDB resource provider for the subscription" + } + }, + { + "name": "Microsoft.DocumentDB/operations/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "operations", + "Operation": "List operations", + "Description": "Read operations available for the Microsoft DocumentDB " + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/PrivateEndpointConnectionsApproval/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account Private Endpoint Connection Approval", + "Operation": "Microsoft.DocumentDB/databaseAccounts/PrivateEndpointConnectionsApproval/action", + "Description": "Manage a private endpoint connection of Database Account" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnectionProxies/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account Private Endpoint Connection Proxy", + "Operation": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnectionProxies/read", + "Description": "Read a private endpoint connection proxy of Database Account" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnectionProxies/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account Private Endpoint Connection Proxy", + "Operation": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnectionProxies/write", + "Description": "Create or update a private endpoint connection proxy of Database Account" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnectionProxies/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account Private Endpoint Connection Proxy", + "Operation": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnectionProxies/delete", + "Description": "Delete a private endpoint connection proxy of Database Account" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnectionProxies/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Operation Result", + "Operation": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnectionProxies/operationResults/read", + "Description": "Read Status of private endpoint connection proxy asynchronous operation" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnectionProxies/validate/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account Private Endpoint Connection Proxy", + "Operation": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnectionProxies/validate/action", + "Description": "Validate a private endpoint connection proxy of Database Account" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnections/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account Private Endpoint Connection", + "Operation": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnections/read", + "Description": "Read a private endpoint connection or list all the private endpoint connections of a Database Account" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnections/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account Private Endpoint Connection", + "Operation": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnections/write", + "Description": "Create or update a private endpoint connection of a Database Account" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnections/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account Private Endpoint Connection", + "Operation": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnections/delete", + "Description": "Delete a private endpoint connection of a Database Account" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnections/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Operation Result", + "Operation": "Microsoft.DocumentDB/databaseAccounts/privateEndpointConnections/operationResults/read", + "Description": "Read Status of privateEndpointConnenctions asynchronous operation" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/privateLinkResources/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account Private Link Resource", + "Operation": "Microsoft.DocumentDB/databaseAccounts/privateLinkResources/read", + "Description": "Read a private link resource or list all the private link resources of a Database Account" + } + }, + { + "name": "Microsoft.DocumentDB/locations/operationsStatus/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Asynchronous Operations", + "Operation": "Microsoft.DocumentDB/locations/operationsStatus/read", + "Description": "Reads Status of Asynchronous Operations" + } + }, + { + "name": "Microsoft.DocumentDB/locations/deleteVirtualNetworkOrSubnets/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Microsoft.DocumentDB/locations/deleteVirtualNetworkOrSubnets/action", + "Description": "Notifies Microsoft.DocumentDB that VirtualNetwork or Subnet is being deleted" + } + }, + { + "name": "Microsoft.DocumentDB/locations/deleteVirtualNetworkOrSubnets/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Operation Result", + "Operation": "Microsoft.DocumentDB/locations/deleteVirtualNetworkOrSubnets/operationResults/read", + "Description": "Read Status of deleteVirtualNetworkOrSubnets asynchronous operation" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/restore/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "", + "Operation": "Microsoft.DocumentDB/databaseAccounts/restore/action", + "Description": "Submit a restore request" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/backup/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "", + "Operation": "Microsoft.DocumentDB/databaseAccounts/backup/action", + "Description": "Submit a request to configure backup" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Notebook Workspace", + "Operation": "Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces/write", + "Description": "Create or update a notebook workspace" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Notebook Workspace", + "Operation": "Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces/read", + "Description": "Read a notebook workspace" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces/delete", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Notebook Workspace", + "Operation": "Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces/delete", + "Description": "Delete a notebook workspace" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces/operationResults/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Operation Result", + "Operation": "Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces/operationResults/read", + "Description": "Read the status of an asynchronous operation on notebook workspaces" + } + }, + { + "name": "Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces/listConnectionInfo/action", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Notebook Workspace", + "Operation": "Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces/listConnectionInfo/action", + "Description": "List the connection info for a notebook workspace" + } + }, + { + "name": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Restorable database account", + "Operation": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read", + "Description": "Read a restorable database account or List all the restorable database accounts" + } + }, + { + "name": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restore/action ", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Restore action on restorable database account", + "Operation": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restore/action", + "Description": "Submit a restore request" + } + }, + { + "origin": "system", + "name": "Microsoft.DocumentDB/databaseAccounts/providers/Microsoft.Insights/logDefinitions/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Read database account log definitions", + "Description": "Gets the available log catageries for Database Account" + }, + "properties": { + "serviceSpecification": { + "logSpecifications": [ + { + "name": "DataPlaneRequests", + "displayName": "DataPlaneRequests", + "blobDuration": "PT1H" + }, + { + "name": "MongoRequests", + "displayName": "MongoRequests", + "blobDuration": "PT1H" + }, + { + "name": "QueryRuntimeStatistics", + "displayName": "QueryRuntimeStatistics", + "blobDuration": "PT1H" + }, + { + "name": "PartitionKeyStatistics", + "displayName": "PartitionKeyStatistics", + "blobDuration": "PT1H" + }, + { + "name": "PartitionKeyRUConsumption", + "displayName": "PartitionKeyRUConsumption", + "blobDuration": "PT1H" + }, + { + "name": "ControlPlaneRequests", + "displayName": "ControlPlaneRequests", + "blobDuration": "PT1H" + }, + { + "name": "CassandraRequests", + "displayName": "CassandraRequests", + "blobDuration": "PT1H" + }, + { + "name": "GremlinRequests", + "displayName": "GremlinRequests", + "blobDuration": "PT1H" + } + ] + } + } + }, + { + "origin": "system", + "name": "Microsoft.DocumentDB/databaseAccounts/providers/Microsoft.Insights/diagnosticSettings/read", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Write diagnostic setting", + "Description": "Gets the diagnostic setting for the resource" + } + }, + { + "origin": "system", + "name": "Microsoft.DocumentDB/databaseAccounts/providers/Microsoft.Insights/diagnosticSettings/write", + "display": { + "Provider": "Microsoft DocumentDB", + "Resource": "Database Account", + "Operation": "Write diagnostic setting", + "Description": "Creates or updates the diagnostic setting for the resource" + } + }, + { + "origin": "system", + "name": "Microsoft.DocumentDB/databaseAccounts/providers/Microsoft.Insights/metricDefinitions/read", + "display": { + "Provider": "Microsoft DocumentDb", + "Resource": "Database Account", + "Operation": "Get database account metric definitions", + "Description": "Gets the available metrics for the database Account" + }, + "properties": { + "serviceSpecification": { + "metricSpecifications": [ + { + "name": "AddRegion", + "displayName": "Region Added", + "internalMetricName": "AddRegion", + "displayDescription": "Region Added", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "Region", + "internalName": "Region" + } + ] + }, + { + "name": "AutoscaleMaxThroughput", + "displayName": "Autoscale Max Throughput", + "internalMetricName": "AutoscaleMaxThroughput", + "displayDescription": "Autoscale Max Throughput", + "unit": "Count", + "aggregationType": "Maximum", + "lockAggregationType": "Maximum", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Maximum" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + } + ] + }, + { + "name": "AvailableStorage", + "displayName": "(deprecated) Available Storage", + "internalMetricName": "AvailableStorage", + "displayDescription": "\u0022Available Storage\u0022 will be removed from Azure Monitor at the end of September 2020. Cosmos DB collection storage size is now unlimited. The only restriction is that the storage size for each logical partition key is 20GB. You can enable PartitionKeyStatistics in Diagnostic Log to know the storage consumption for top partition keys. For more info about Cosmos DB storage quota, please check this doc https://docs.microsoft.com/en-us/azure/cosmos-db/concepts-limits. After deprecation, the remaining alert rules still defined on the deprecated metric will be automatically disabled post the deprecation date.", + "unit": "Bytes", + "aggregationType": "Total", + "lockAggregationType": "Total", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Total", + " Average" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "Region", + "internalName": "Region" + } + ] + }, + { + "name": "CassandraConnectionClosures", + "displayName": "Cassandra Connection Closures", + "internalMetricName": "CassandraConnectionClosures", + "displayDescription": "Number of Cassandra connections that were closed, reported at a 1 minute granularity", + "unit": "Count", + "aggregationType": "Total", + "lockAggregationType": "Count", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Average", + " Minimum", + " Maximum", + " Total" + ], + "supportedTimeGrainTypes": [ + "PT1M" + ], + "dimensions": [ + { + "name": "APIType", + "internalName": "APIType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "CassandraService" + } + ] + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "ClosureReason", + "internalName": "ClosureReason" + } + ] + }, + { + "name": "CassandraConnectorAvgReplicationLatency", + "displayName": "Cassandra Connector Average ReplicationLatency", + "internalMetricName": "AverageReplicationLatencyInMilliseconds", + "displayDescription": "Cassandra Connector Average ReplicationLatency", + "unit": "MilliSeconds", + "aggregationType": "Average", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "DatabaseAccount", + "supportedAggregationTypes": [ + "Average" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [] + }, + { + "name": "CassandraConnectorReplicationHealthStatus", + "displayName": "Cassandra Connector Replication Health Status", + "internalMetricName": "ReplicationHealthStatus", + "displayDescription": "Cassandra Connector Replication Health Status", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "DatabaseAccount", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "NotStarted", + "displayName": "Replication Not Started", + "internalName": "NotStarted" + }, + { + "name": "ReplicationInProgress", + "displayName": "Replication In Progress", + "internalName": "ReplicationInProgress" + }, + { + "name": "Error", + "displayName": "Replication In Error", + "internalName": "Error" + } + ] + }, + { + "name": "CassandraKeyspaceCreate", + "displayName": "Cassandra Keyspace Created", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Cassandra Keyspace Created", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "displayName": "Keyspace Name", + "internalName": "ResourceName" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "cassandra" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "keyspaces" + }, + { + "value": "cassandrakeyspaces" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Create" + } + ] + } + ] + }, + { + "name": "CassandraKeyspaceDelete", + "displayName": "Cassandra Keyspace Deleted", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Cassandra Keyspace Deleted", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Keyspace Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "cassandra" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "keyspaces" + }, + { + "value": "cassandrakeyspaces" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Delete" + } + ] + } + ] + }, + { + "name": "CassandraKeyspaceThroughputUpdate", + "displayName": "Cassandra Keyspace Throughput Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Cassandra Keyspace Throughput Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Keyspace Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "cassandra" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "keyspaces" + }, + { + "value": "cassandrakeyspaces" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "True" + } + ] + } + ] + }, + { + "name": "CassandraKeyspaceUpdate", + "displayName": "Cassandra Keyspace Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Cassandra Keyspace Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Keyspace Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "cassandra" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "keyspaces" + }, + { + "value": "cassandrakeyspaces" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Upsert" + }, + { + "value": "Replace" + } + ] + } + ] + }, + { + "name": "CassandraRequestCharges", + "displayName": "Cassandra Request Charges", + "internalMetricName": "CassandraRequestCharges", + "displayDescription": "RUs consumed for Cassandra requests made", + "unit": "Count", + "aggregationType": "Total", + "lockAggregationType": "Total", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Total", + "Average", + "Minimum", + "Maximum" + ], + "supportedTimeGrainTypes": [ + "PT1M" + ], + "dimensions": [ + { + "name": "APIType", + "internalName": "APIType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "CassandraService" + } + ] + }, + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "OperationType", + "internalName": "OperationType" + }, + { + "name": "ResourceType", + "internalName": "ResourceType" + } + ] + }, + { + "name": "CassandraRequests", + "displayName": "Cassandra Requests", + "internalMetricName": "CassandraRequests", + "displayDescription": "Number of Cassandra requests made", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT1M" + ], + "dimensions": [ + { + "name": "APIType", + "internalName": "APIType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "CassandraService" + } + ] + }, + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "OperationType", + "internalName": "OperationType" + }, + { + "name": "ResourceType", + "internalName": "ResourceType" + }, + { + "name": "ErrorCode", + "internalName": "ErrorCode" + } + ] + }, + { + "name": "CassandraTableCreate", + "displayName": "Cassandra Table Created", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Cassandra Table Created", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "displayName": "Keyspace Name", + "internalName": "ResourceName" + }, + { + "name": "ChildResourceName", + "displayName": "Table Name", + "internalName": "ChildResourceName" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "cassandra" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "tables" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Create" + } + ] + } + ] + }, + { + "name": "CassandraTableDelete", + "displayName": "Cassandra Table Deleted", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Cassandra Table Deleted", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Keyspace Name" + }, + { + "name": "ChildResourceName", + "internalName": "ChildResourceName", + "displayName": "Table Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "cassandra" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "tables" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Delete" + } + ] + } + ] + }, + { + "name": "CassandraTableThroughputUpdate", + "displayName": "Cassandra Table Throughput Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Cassandra Table Throughput Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Keyspace Name" + }, + { + "name": "ChildResourceName", + "internalName": "ChildResourceName", + "displayName": "Table Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "cassandra" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "tables" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "True" + } + ] + } + ] + }, + { + "name": "CassandraTableUpdate", + "displayName": "Cassandra Table Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Cassandra Table Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Keyspace Name" + }, + { + "name": "ChildResourceName", + "internalName": "ChildResourceName", + "displayName": "Table Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "cassandra" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "tables" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Upsert" + }, + { + "value": "Replace" + } + ] + } + ] + }, + { + "name": "CreateAccount", + "displayName": "Account Created", + "internalMetricName": "CreateAccount", + "displayDescription": "Account Created", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [] + }, + { + "name": "DataUsage", + "displayName": "Data Usage", + "internalMetricName": "DataUsage", + "displayDescription": "Total data usage reported at 5 minutes granularity", + "unit": "Bytes", + "aggregationType": "Total", + "lockAggregationType": "Total", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Total", + " Average" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "Region", + "internalName": "Region" + } + ] + }, + { + "name": "DeleteAccount", + "displayName": "Account Deleted", + "internalMetricName": "DeleteAccount", + "displayDescription": "Account Deleted", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [] + }, + { + "name": "DocumentCount", + "displayName": "Document Count", + "internalMetricName": "DocumentCount", + "displayDescription": "Total document count reported at 5 minutes granularity", + "unit": "Count", + "aggregationType": "Total", + "lockAggregationType": "Total", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Total", + " Average" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "Region", + "internalName": "Region" + } + ] + }, + { + "name": "DocumentQuota", + "displayName": "Document Quota", + "internalMetricName": "DocumentQuota", + "displayDescription": "Total storage quota reported at 5 minutes granularity", + "unit": "Bytes", + "aggregationType": "Total", + "lockAggregationType": "Total", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Total", + " Average" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "Region", + "internalName": "Region" + } + ] + }, + { + "name": "GremlinDatabaseCreate", + "displayName": "Gremlin Database Created", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Gremlin Database Created", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "displayName": "Database Name", + "internalName": "ResourceName" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "gremlin" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "databases" + }, + { + "value": "gremlindatabases" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Create" + } + ] + } + ] + }, + { + "name": "GremlinDatabaseDelete", + "displayName": "Gremlin Database Deleted", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Gremlin Database Deleted", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "gremlin" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "databases" + }, + { + "value": "gremlindatabases" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Delete" + } + ] + } + ] + }, + { + "name": "GremlinDatabaseThroughputUpdate", + "displayName": "Gremlin Database Throughput Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Gremlin Database Throughput Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "sql" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "databases" + }, + { + "value": "gremlindatabases" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "True" + } + ] + } + ] + }, + { + "name": "GremlinDatabaseUpdate", + "displayName": "Gremlin Database Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Gremlin Database Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "gremlin" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "databases" + }, + { + "value": "gremlindatabases" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Upsert" + }, + { + "value": "Replace" + } + ] + } + ] + }, + { + "name": "GremlinGraphCreate", + "displayName": "Gremlin Graph Created", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Gremlin Graph Created", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "displayName": "Database Name", + "internalName": "ResourceName" + }, + { + "name": "ChildResourceName", + "displayName": "Graph Name", + "internalName": "ChildResourceName" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "gremlin" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "graphs" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Create" + } + ] + } + ] + }, + { + "name": "GremlinGraphDelete", + "displayName": "Gremlin Graph Deleted", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Gremlin Graph Deleted", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ChildResourceName", + "internalName": "ChildResourceName", + "displayName": "Graph Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "gremlin" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "graphs" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Delete" + } + ] + } + ] + }, + { + "name": "GremlinGraphThroughputUpdate", + "displayName": "Gremlin Graph Throughput Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Gremlin Graph Throughput Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ChildResourceName", + "internalName": "ChildResourceName", + "displayName": "Graph Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "sql" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "graphs" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "True" + } + ] + } + ] + }, + { + "name": "GremlinGraphUpdate", + "displayName": "Gremlin Graph Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Gremlin Graph Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ChildResourceName", + "internalName": "ChildResourceName", + "displayName": "Graph Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "gremlin" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "graphs" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Upsert" + }, + { + "value": "Replace" + } + ] + } + ] + }, + { + "name": "IndexUsage", + "displayName": "Index Usage", + "internalMetricName": "IndexUsage", + "displayDescription": "Total index usage reported at 5 minutes granularity", + "unit": "Bytes", + "aggregationType": "Total", + "lockAggregationType": "Total", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Total", + " Average" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "Region", + "internalName": "Region" + } + ] + }, + { + "name": "MetadataRequests", + "displayName": "Metadata Requests", + "internalMetricName": "MetadataRequests", + "displayDescription": "Count of metadata requests. Cosmos DB maintains system metadata collection for each account, that allows you to enumerate collections, databases, etc, and their configurations, free of charge.", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "dimensions": [ + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "StatusCode", + "internalName": "StatusCode" + }, + { + "name": "Role", + "internalName": "Role", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "MasterCluster0" + } + ] + } + ] + }, + { + "name": "MongoCollectionCreate", + "displayName": "Mongo Collection Created", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Mongo Collection Created", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "displayName": "Database Name", + "internalName": "ResourceName" + }, + { + "name": "ChildResourceName", + "displayName": "Collection Name", + "internalName": "ChildResourceName" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "mongodb" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "collections" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Create" + } + ] + } + ] + }, + { + "name": "MongoCollectionDelete", + "displayName": "Mongo Collection Deleted", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Mongo Collection Deleted", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ChildResourceName", + "internalName": "ChildResourceName", + "displayName": "Collection Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "mongodb" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "collections" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Delete" + } + ] + } + ] + }, + { + "name": "MongoCollectionThroughputUpdate", + "displayName": "Mongo Collection Throughput Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Mongo Collection Throughput Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ChildResourceName", + "internalName": "ChildResourceName", + "displayName": "Collection Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "mongodb" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "collections" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "True" + } + ] + } + ] + }, + { + "name": "MongoCollectionUpdate", + "displayName": "Mongo Collection Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Mongo Collection Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ChildResourceName", + "internalName": "ChildResourceName", + "displayName": "Collection Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "mongodb" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "collections" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Upsert" + }, + { + "value": "Replace" + } + ] + } + ] + }, + { + "name": "MongoDBDatabaseCreate", + "displayName": "Mongo Database Created", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Mongo Database Created", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "displayName": "Database Name", + "internalName": "ResourceName" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "mongodb" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "databases" + }, + { + "value": "mongodbdatabases" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Create" + } + ] + } + ] + }, + { + "name": "MongoDBDatabaseUpdate", + "displayName": "Mongo Database Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Mongo Database Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "mongodb" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "databases" + }, + { + "value": "mongodbdatabases" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Upsert" + }, + { + "value": "Replace" + } + ] + } + ] + }, + { + "name": "MongoDatabaseDelete", + "displayName": "Mongo Database Deleted", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Mongo Database Deleted", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "mongodb" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "databases" + }, + { + "value": "mongodbdatabases" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Delete" + } + ] + } + ] + }, + { + "name": "MongoDatabaseThroughputUpdate", + "displayName": "Mongo Database Throughput Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Mongo Database Throughput Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "mongodb" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "databases" + }, + { + "value": "mongodbdatabases" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "True" + } + ] + } + ] + }, + { + "name": "MongoRequestCharge", + "displayName": "Mongo Request Charge", + "internalMetricName": "MongoRequestCharge", + "displayDescription": "Mongo Request Units Consumed", + "unit": "Count", + "aggregationType": "Total", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Total", + "Average", + "Maximum" + ], + "dimensions": [ + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "CommandName", + "internalName": "CommandName" + }, + { + "name": "ErrorCode", + "internalName": "ErrorCode" + }, + { + "name": "Status", + "internalName": "Status" + } + ] + }, + { + "name": "MongoRequests", + "displayName": "Mongo Requests", + "internalMetricName": "MongoRequests", + "displayDescription": "Number of Mongo Requests Made", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "dimensions": [ + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "CommandName", + "internalName": "CommandName" + }, + { + "name": "ErrorCode", + "internalName": "ErrorCode" + }, + { + "name": "Status", + "internalName": "Status" + } + ] + }, + { + "name": "MongoRequestsCount", + "displayName": "Mongo Request Rate", + "internalMetricName": "MongoRequests", + "displayDescription": "Mongo request Count per second", + "unit": "CountPerSecond", + "aggregationType": "Average", + "lockAggregationType": "Average", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Average" + ], + "dimensions": [ + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "CommandName", + "internalName": "CommandName", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "count" + } + ] + }, + { + "name": "ErrorCode", + "internalName": "ErrorCode" + } + ] + }, + { + "name": "MongoRequestsDelete", + "displayName": "Mongo Delete Request Rate", + "internalMetricName": "MongoRequests", + "displayDescription": "Mongo Delete request per second", + "unit": "CountPerSecond", + "aggregationType": "Average", + "lockAggregationType": "Average", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Average" + ], + "dimensions": [ + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "CommandName", + "internalName": "CommandName", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Delete" + }, + { + "value": "OP_DELETE" + } + ] + }, + { + "name": "ErrorCode", + "internalName": "ErrorCode" + } + ] + }, + { + "name": "MongoRequestsInsert", + "displayName": "Mongo Insert Request Rate", + "internalMetricName": "MongoRequests", + "displayDescription": "Mongo Insert count per second", + "unit": "CountPerSecond", + "aggregationType": "Average", + "lockAggregationType": "Average", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Average" + ], + "dimensions": [ + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "CommandName", + "internalName": "CommandName", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "insert" + }, + { + "value": "OP_INSERT" + } + ] + }, + { + "name": "ErrorCode", + "internalName": "ErrorCode" + } + ] + }, + { + "name": "MongoRequestsQuery", + "displayName": "Mongo Query Request Rate", + "internalMetricName": "MongoRequests", + "displayDescription": "Mongo Query request per second", + "unit": "CountPerSecond", + "aggregationType": "Average", + "lockAggregationType": "Average", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Average" + ], + "dimensions": [ + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "CommandName", + "internalName": "CommandName", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "find" + }, + { + "value": "OP_QUERY" + }, + { + "value": "getMore" + }, + { + "value": "OP_GET_MORE" + } + ] + }, + { + "name": "ErrorCode", + "internalName": "ErrorCode" + } + ] + }, + { + "name": "MongoRequestsUpdate", + "displayName": "Mongo Update Request Rate", + "internalMetricName": "MongoRequests", + "displayDescription": "Mongo Update request per second", + "unit": "CountPerSecond", + "aggregationType": "Average", + "lockAggregationType": "Average", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Average" + ], + "dimensions": [ + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "CommandName", + "internalName": "CommandName", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "OP_UPDATE" + }, + { + "value": "findandmodify" + } + ] + }, + { + "name": "ErrorCode", + "internalName": "ErrorCode" + } + ] + }, + { + "name": "NormalizedRUConsumption", + "displayName": "Normalized RU Consumption", + "internalMetricName": "NormalizedRUConsumption", + "displayDescription": "Max RU consumption percentage per minute", + "unit": "Percent", + "aggregationType": "Maximum", + "lockAggregationType": "Maximum", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Maximum", + " Average" + ], + "supportedTimeGrainTypes": [ + "PT1M", + "PT5M", + "PT1H", + "P1D" + ], + "dimensions": [ + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "PartitionKeyRangeId", + "internalName": "PartitionKeyRangeId" + } + ] + }, + { + "name": "ProvisionedThroughput", + "displayName": "Provisioned Throughput", + "internalMetricName": "ProvisionedThroughput", + "displayDescription": "Provisioned Throughput", + "unit": "Count", + "aggregationType": "Maximum", + "lockAggregationType": "Maximum", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Maximum" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + } + ] + }, + { + "name": "RegionFailover", + "displayName": "Region Failed Over", + "internalMetricName": "RegionFailover", + "displayDescription": "Region Failed Over", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [] + }, + { + "name": "RemoveRegion", + "displayName": "Region Removed", + "internalMetricName": "RemoveRegion", + "displayDescription": "Region Removed", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "Region", + "internalName": "Region" + } + ] + }, + { + "name": "ReplicationLatency", + "displayName": "P99 Replication Latency", + "internalMetricName": "ReplicationLatency", + "displayDescription": "P99 Replication Latency across source and target regions for geo-enabled account", + "unit": "MilliSeconds", + "aggregationType": "Average", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccount", + "supportedAggregationTypes": [ + "Minimum", + "Maximum", + "Average" + ], + "dimensions": [ + { + "name": "SourceRegion", + "internalName": "SourceRegion" + }, + { + "name": "TargetRegion", + "internalName": "TargetRegion" + } + ] + }, + { + "name": "ServerSideLatency", + "displayName": "Server Side Latency", + "internalMetricName": "ServerSideLatency", + "displayDescription": "Server Side Latency", + "unit": "MilliSeconds", + "aggregationType": "Average", + "lockAggregationType": "Average", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Average" + ], + "supportedTimeGrainTypes": [ + "PT1M" + ], + "dimensions": [ + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "ConnectionMode", + "internalName": "ConnectionMode" + }, + { + "name": "OperationType", + "internalName": "OperationType" + }, + { + "name": "PublicAPIType", + "internalName": "PublicAPIType" + } + ] + }, + { + "name": "ServiceAvailability", + "displayName": "Service Availability", + "internalMetricName": "ServiceAvailability", + "displayDescription": "Account requests availability at one hour, day or month granularity", + "unit": "Percent", + "aggregationType": "Average", + "lockAggregationType": "Average", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Minimum", + "Average", + "Maximum" + ], + "supportedTimeGrainTypes": [ + "PT1H" + ], + "dimensions": [] + }, + { + "name": "SqlContainerCreate", + "displayName": "Sql Container Created", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Sql Container Created", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "displayName": "Database Name", + "internalName": "ResourceName" + }, + { + "name": "ChildResourceName", + "displayName": "Container Name", + "internalName": "ChildResourceName" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "sql" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "containers" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Create" + } + ] + } + ] + }, + { + "name": "SqlContainerDelete", + "displayName": "Sql Container Deleted", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Sql Container Deleted", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ChildResourceName", + "internalName": "ChildResourceName", + "displayName": "Container Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "sql" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "containers" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Delete" + } + ] + } + ] + }, + { + "name": "SqlContainerThroughputUpdate", + "displayName": "Sql Container Throughput Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Sql Container Throughput Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ChildResourceName", + "internalName": "ChildResourceName", + "displayName": "Container Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "sql" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "containers" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "True" + } + ] + } + ] + }, + { + "name": "SqlContainerUpdate", + "displayName": "Sql Container Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Sql Container Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ChildResourceName", + "internalName": "ChildResourceName", + "displayName": "Container Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "sql" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "containers" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Upsert" + }, + { + "value": "Replace" + } + ] + } + ] + }, + { + "name": "SqlDatabaseCreate", + "displayName": "Sql Database Created", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Sql Database Created", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "displayName": "Database Name", + "internalName": "ResourceName" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "sql" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "sqldatabases" + }, + { + "value": "databases" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Create" + } + ] + } + ] + }, + { + "name": "SqlDatabaseDelete", + "displayName": "Sql Database Deleted", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Sql Database Deleted", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "sql" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "databases" + }, + { + "value": "sqldatabases" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Delete" + } + ] + } + ] + }, + { + "name": "SqlDatabaseThroughputUpdate", + "displayName": "Sql Database Throughput Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Sql Database Throughput Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "sql" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "databases" + }, + { + "value": "sqldatabases" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "True" + } + ] + } + ] + }, + { + "name": "SqlDatabaseUpdate", + "displayName": "Sql Database Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "Sql Database Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Database Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "sql" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "databases" + }, + { + "value": "sqldatabases" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Upsert" + }, + { + "value": "Replace" + } + ] + } + ] + }, + { + "name": "TableTableCreate", + "displayName": "AzureTable Table Created", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "AzureTable Table Created", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "displayName": "Table Name", + "internalName": "ResourceName" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "table" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "tables" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Create" + } + ] + } + ] + }, + { + "name": "TableTableDelete", + "displayName": "AzureTable Table Deleted", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "AzureTable Table Deleted", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Table Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "table" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "tables" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Delete" + } + ] + } + ] + }, + { + "name": "TableTableThroughputUpdate", + "displayName": "AzureTable Table Throughput Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "AzureTable Table Throughput Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Table Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "table" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "tables" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "True" + } + ] + } + ] + }, + { + "name": "TableTableUpdate", + "displayName": "AzureTable Table Updated", + "internalMetricName": "ControlPlaneArmAPIRequest", + "displayDescription": "AzureTable Table Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "ResourceName", + "internalName": "ResourceName", + "displayName": "Table Name" + }, + { + "name": "ApiKind", + "internalName": "ApiKind", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "table" + } + ] + }, + { + "name": "ApiKindResourceType", + "internalName": "ApiKindResourceType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "tables" + } + ] + }, + { + "name": "IsThroughputRequest", + "internalName": "IsThroughputRequest", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "False" + } + ] + }, + { + "name": "OperationType", + "internalName": "OperationType", + "isHidden": true, + "defaultDimensionValues": [ + { + "value": "Upsert" + }, + { + "value": "Replace" + } + ] + } + ] + }, + { + "name": "TotalRequestUnits", + "displayName": "Total Request Units", + "internalMetricName": "TotalRequestUnits", + "displayDescription": "Request Units consumed", + "unit": "Count", + "aggregationType": "Total", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Total", + " Average" + ], + "dimensions": [ + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "StatusCode", + "internalName": "StatusCode" + }, + { + "name": "OperationType", + "internalName": "OperationType" + }, + { + "name": "Status", + "internalName": "Status" + } + ] + }, + { + "name": "TotalRequests", + "displayName": "Total Requests", + "internalMetricName": "TotalRequests", + "displayDescription": "Number of requests made", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "dimensions": [ + { + "name": "DatabaseName", + "internalName": "DatabaseName" + }, + { + "name": "CollectionName", + "internalName": "CollectionName" + }, + { + "name": "Region", + "internalName": "Region" + }, + { + "name": "StatusCode", + "internalName": "StatusCode" + }, + { + "name": "OperationType", + "internalName": "OperationType" + }, + { + "name": "Status", + "internalName": "Status" + } + ] + }, + { + "name": "UpdateAccountKeys", + "displayName": "Account Keys Updated", + "internalMetricName": "UpdateAccountKeys", + "displayDescription": "Account Keys Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": true, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "KeyType", + "internalName": "KeyType" + } + ] + }, + { + "name": "UpdateAccountNetworkSettings", + "displayName": "Account Network Settings Updated", + "internalMetricName": "UpdateAccountNetworkSettings", + "displayDescription": "Account Network Settings Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [] + }, + { + "name": "UpdateAccountReplicationSettings", + "displayName": "Account Replication Settings Updated", + "internalMetricName": "UpdateAccountReplicationSettings", + "displayDescription": "Account Replication Settings Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [] + }, + { + "name": "UpdateDiagnosticsSettings", + "displayName": "Account Diagnostic Settings Updated", + "internalMetricName": "UpdateDiagnosticSettings", + "displayDescription": "Account Diagnostic Settings Updated", + "unit": "Count", + "aggregationType": "Count", + "lockAggregationType": "", + "sourceMdmAccount": "CosmosDBCustomer", + "sourceMdmNamespace": "AzureMonitor", + "fillGapWithZero": false, + "category": "Requests", + "resourceIdDimensionNameOverride": "GlobalDatabaseAccountName", + "supportedAggregationTypes": [ + "Count" + ], + "supportedTimeGrainTypes": [ + "PT5M" + ], + "dimensions": [ + { + "name": "DiagnosticSettingsName", + "internalName": "DiagnosticSettingsName", + "displayName": "DiagnosticSettings Name" + }, + { + "name": "ResourceGroupName", + "internalName": "ResourceGroupName", + "displayName": "ResourceGroup Name" + } + ] + } + ] + } + } + } + ] + } + } + ], + "Variables": { + "RandomSeed": "330372063", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/cosmosdb/test-resources.json b/sdk/cosmosdb/test-resources.json new file mode 100644 index 000000000000..a837d5a0f2b8 --- /dev/null +++ b/sdk/cosmosdb/test-resources.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + ] +}