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
+
+
\ 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.
+
+//