From 325e66c831dd71932ecd4b8acc3905aa3c973d84 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Wed, 17 Jun 2020 19:59:47 +0000 Subject: [PATCH] Generated from 5e6bac5d7a8032e96f9c465bf2134bd0082c1884 add default response --- .../v2020_03_01/CassandraResources.java | 46 + .../v2020_03_01/GremlinResources.java | 46 + .../v2020_03_01/MongoDBResources.java | 46 + .../cosmosdb/v2020_03_01/SqlResources.java | 46 + .../cosmosdb/v2020_03_01/TableResources.java | 22 + .../CassandraResourcesImpl.java | 48 + .../CassandraResourcesInner.java | 1224 ++++++++++++---- .../implementation/GremlinResourcesImpl.java | 48 + .../implementation/GremlinResourcesInner.java | 1228 +++++++++++++---- .../implementation/MongoDBResourcesImpl.java | 48 + .../implementation/MongoDBResourcesInner.java | 1224 ++++++++++++---- .../implementation/SqlResourcesImpl.java | 48 + .../implementation/SqlResourcesInner.java | 1224 ++++++++++++---- .../implementation/TableResourcesImpl.java | 24 + .../implementation/TableResourcesInner.java | 350 +++++ 15 files changed, 4674 insertions(+), 998 deletions(-) diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/CassandraResources.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/CassandraResources.java index 3a9c6fc356663..daaa41231f6d9 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/CassandraResources.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/CassandraResources.java @@ -86,6 +86,28 @@ public interface CassandraResources { */ Observable updateCassandraKeyspaceThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters); + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToAutoscaleCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName); + + /** + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToManualThroughputCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName); + /** * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. * @@ -111,6 +133,30 @@ public interface CassandraResources { */ Observable updateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters); + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToAutoscaleCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToManualThroughputCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName); + /** * Gets the Cassandra table under an existing Azure Cosmos DB database account. * diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/GremlinResources.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/GremlinResources.java index 7ff3140d1f40b..734311413af8e 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/GremlinResources.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/GremlinResources.java @@ -86,6 +86,28 @@ public interface GremlinResources { */ Observable updateGremlinDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters); + /** + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToAutoscaleGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToManualThroughputGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName); + /** * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. * @@ -111,6 +133,30 @@ public interface GremlinResources { */ Observable updateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters); + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToAutoscaleGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToManualThroughputGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName); + /** * Gets the Gremlin graph under an existing Azure Cosmos DB database account. * diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/MongoDBResources.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/MongoDBResources.java index d4f3d316da9e8..4dc3a54b00cf6 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/MongoDBResources.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/MongoDBResources.java @@ -86,6 +86,28 @@ public interface MongoDBResources { */ Observable updateMongoDBDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters); + /** + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToAutoscaleMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToManualThroughputMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName); + /** * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. * @@ -111,6 +133,30 @@ public interface MongoDBResources { */ Observable updateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters); + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToAutoscaleMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToManualThroughputMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName); + /** * Gets the MongoDB collection under an existing Azure Cosmos DB database account. * diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/SqlResources.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/SqlResources.java index a724657d65c69..d0bf0883c891a 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/SqlResources.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/SqlResources.java @@ -110,6 +110,28 @@ public interface SqlResources { */ Observable updateSqlDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters); + /** + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToAutoscaleSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToManualThroughputSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName); + /** * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. * @@ -135,6 +157,30 @@ public interface SqlResources { */ Observable updateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters); + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToAutoscaleSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToManualThroughputSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName); + /** * Gets the SQL container under an existing Azure Cosmos DB database account. * diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/TableResources.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/TableResources.java index a0ad6c734fb57..1b22f545d0cb2 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/TableResources.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/TableResources.java @@ -78,4 +78,26 @@ public interface TableResources { */ Observable updateTableThroughputAsync(String resourceGroupName, String accountName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters); + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToAutoscaleTableAsync(String resourceGroupName, String accountName, String tableName); + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable migrateToManualThroughputTableAsync(String resourceGroupName, String accountName, String tableName); + } diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/CassandraResourcesImpl.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/CassandraResourcesImpl.java index 97a549ca4804a..83be568315f57 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/CassandraResourcesImpl.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/CassandraResourcesImpl.java @@ -139,6 +139,30 @@ public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner }); } + @Override + public Observable migrateToAutoscaleCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName) { + CassandraResourcesInner client = this.inner(); + return client.migrateToAutoscaleCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable migrateToManualThroughputCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName) { + CassandraResourcesInner client = this.inner(); + return client.migrateToManualThroughputCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + @Override public Observable getCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { CassandraResourcesInner client = this.inner(); @@ -163,6 +187,30 @@ public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner }); } + @Override + public Observable migrateToAutoscaleCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + CassandraResourcesInner client = this.inner(); + return client.migrateToAutoscaleCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable migrateToManualThroughputCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + CassandraResourcesInner client = this.inner(); + return client.migrateToManualThroughputCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + @Override public Observable getCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { CassandraResourcesInner client = this.inner(); diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/CassandraResourcesInner.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/CassandraResourcesInner.java index 09eaeeba0f383..b615684f2d318 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/CassandraResourcesInner.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/CassandraResourcesInner.java @@ -13,6 +13,7 @@ import com.microsoft.azure.CloudException; import com.microsoft.azure.management.cosmosdb.v2020_03_01.CassandraKeyspaceCreateUpdateParameters; import com.microsoft.azure.management.cosmosdb.v2020_03_01.CassandraTableCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2020_03_01.ErrorResponseException; import com.microsoft.azure.management.cosmosdb.v2020_03_01.ThroughputSettingsUpdateParameters; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; @@ -27,6 +28,7 @@ import retrofit2.http.Headers; import retrofit2.http.HTTP; import retrofit2.http.Path; +import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Query; import retrofit2.Response; @@ -95,6 +97,22 @@ interface CassandraResourcesService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default") Observable> beginUpdateCassandraKeyspaceThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.CassandraResources migrateToAutoscaleCassandraKeyspace" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale") + Observable> migrateToAutoscaleCassandraKeyspace(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.CassandraResources beginMigrateToAutoscaleCassandraKeyspace" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale") + Observable> beginMigrateToAutoscaleCassandraKeyspace(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.CassandraResources migrateToManualThroughputCassandraKeyspace" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput") + Observable> migrateToManualThroughputCassandraKeyspace(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.CassandraResources beginMigrateToManualThroughputCassandraKeyspace" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput") + Observable> beginMigrateToManualThroughputCassandraKeyspace(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.CassandraResources listCassandraTables" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables") Observable> listCassandraTables(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -131,6 +149,22 @@ interface CassandraResourcesService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default") Observable> beginUpdateCassandraTableThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.CassandraResources migrateToAutoscaleCassandraTable" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale") + Observable> migrateToAutoscaleCassandraTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.CassandraResources beginMigrateToAutoscaleCassandraTable" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale") + Observable> beginMigrateToAutoscaleCassandraTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.CassandraResources migrateToManualThroughputCassandraTable" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput") + Observable> migrateToManualThroughputCassandraTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.CassandraResources beginMigrateToManualThroughputCassandraTable" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput") + Observable> beginMigrateToManualThroughputCassandraTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -933,22 +967,22 @@ private ServiceResponse beginUpdateCassandraK } /** - * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<CassandraTableGetResultsInner> object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public List listCassandraTables(String resourceGroupName, String accountName, String keyspaceName) { - return listCassandraTablesWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner migrateToAutoscaleCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName) { + return migrateToAutoscaleCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).toBlocking().last().body(); } /** - * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -957,38 +991,38 @@ public List listCassandraTables(String resourceGr * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listCassandraTablesAsync(String resourceGroupName, String accountName, String keyspaceName, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listCassandraTablesWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName), serviceCallback); + public ServiceFuture migrateToAutoscaleCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToAutoscaleCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName), serviceCallback); } /** - * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<CassandraTableGetResultsInner> object + * @return the observable for the request */ - public Observable> listCassandraTablesAsync(String resourceGroupName, String accountName, String keyspaceName) { - return listCassandraTablesWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).map(new Func1>, List>() { + public Observable migrateToAutoscaleCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName) { + return migrateToAutoscaleCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public List call(ServiceResponse> response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<CassandraTableGetResultsInner> object + * @return the observable for the request */ - public Observable>> listCassandraTablesWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName) { + public Observable> migrateToAutoscaleCassandraKeyspaceWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1002,93 +1036,67 @@ public Observable>> listCass throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); } final String apiVersion = "2020-03-01"; - return service.listCassandraTables(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listCassandraTablesDelegate(response); - List items = null; - if (result.body() != null) { - items = result.body().items(); - } - ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> listCassandraTablesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) - .build(response); + Observable> observable = service.migrateToAutoscaleCassandraKeyspace(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the CassandraTableGetResultsInner object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public CassandraTableGetResultsInner getCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName) { - return getCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner beginMigrateToAutoscaleCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName) { + return beginMigrateToAutoscaleCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).toBlocking().single().body(); } /** - * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); + public ServiceFuture beginMigrateToAutoscaleCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToAutoscaleCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName), serviceCallback); } /** - * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the CassandraTableGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable getCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { - return getCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, CassandraTableGetResultsInner>() { + public Observable beginMigrateToAutoscaleCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName) { + return beginMigrateToAutoscaleCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public CassandraTableGetResultsInner call(ServiceResponse response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the CassandraTableGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable> getCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + public Observable> beginMigrateToAutoscaleCassandraKeyspaceWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1101,16 +1109,13 @@ public Observable> getCassandraTa if (keyspaceName == null) { throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); } - if (tableName == null) { - throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); - } final String apiVersion = "2020-03-01"; - return service.getCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.beginMigrateToAutoscaleCassandraKeyspace(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getCassandraTableDelegate(response); + ServiceResponse clientResponse = beginMigrateToAutoscaleCassandraKeyspaceDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1119,78 +1124,71 @@ public Observable> call(Response< }); } - private ServiceResponse getCassandraTableDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse beginMigrateToAutoscaleCassandraKeyspaceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) .build(response); } /** - * Create or update an Azure Cosmos DB Cassandra Table. + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. - * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the CassandraTableGetResultsInner object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public CassandraTableGetResultsInner createUpdateCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { - return createUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).toBlocking().last().body(); + public ThroughputSettingsGetResultsInner migrateToManualThroughputCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName) { + return migrateToManualThroughputCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).toBlocking().last().body(); } /** - * Create or update an Azure Cosmos DB Cassandra Table. + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. - * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createUpdateCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters), serviceCallback); + public ServiceFuture migrateToManualThroughputCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToManualThroughputCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName), serviceCallback); } /** - * Create or update an Azure Cosmos DB Cassandra Table. + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. - * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable createUpdateCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { - return createUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).map(new Func1, CassandraTableGetResultsInner>() { + public Observable migrateToManualThroughputCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName) { + return migrateToManualThroughputCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public CassandraTableGetResultsInner call(ServiceResponse response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Create or update an Azure Cosmos DB Cassandra Table. + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. - * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> createUpdateCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + public Observable> migrateToManualThroughputCassandraKeyspaceWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1203,83 +1201,68 @@ public Observable> createUpdateCa if (keyspaceName == null) { throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); } - if (tableName == null) { - throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); - } - if (createUpdateCassandraTableParameters == null) { - throw new IllegalArgumentException("Parameter createUpdateCassandraTableParameters is required and cannot be null."); - } - Validator.validate(createUpdateCassandraTableParameters); final String apiVersion = "2020-03-01"; - Observable> observable = service.createUpdateCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, createUpdateCassandraTableParameters, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + Observable> observable = service.migrateToManualThroughputCassandraKeyspace(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Create or update an Azure Cosmos DB Cassandra Table. + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. - * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the CassandraTableGetResultsInner object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public CassandraTableGetResultsInner beginCreateUpdateCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { - return beginCreateUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner beginMigrateToManualThroughputCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName) { + return beginMigrateToManualThroughputCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).toBlocking().single().body(); } /** - * Create or update an Azure Cosmos DB Cassandra Table. + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. - * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginCreateUpdateCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginCreateUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters), serviceCallback); + public ServiceFuture beginMigrateToManualThroughputCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToManualThroughputCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName), serviceCallback); } /** - * Create or update an Azure Cosmos DB Cassandra Table. + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. - * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the CassandraTableGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable beginCreateUpdateCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { - return beginCreateUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).map(new Func1, CassandraTableGetResultsInner>() { + public Observable beginMigrateToManualThroughputCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName) { + return beginMigrateToManualThroughputCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public CassandraTableGetResultsInner call(ServiceResponse response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Create or update an Azure Cosmos DB Cassandra Table. + * Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. - * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the CassandraTableGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable> beginCreateUpdateCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + public Observable> beginMigrateToManualThroughputCassandraKeyspaceWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1292,20 +1275,13 @@ public Observable> beginCreateUpd if (keyspaceName == null) { throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); } - if (tableName == null) { - throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); - } - if (createUpdateCassandraTableParameters == null) { - throw new IllegalArgumentException("Parameter createUpdateCassandraTableParameters is required and cannot be null."); - } - Validator.validate(createUpdateCassandraTableParameters); final String apiVersion = "2020-03-01"; - return service.beginCreateUpdateCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, createUpdateCassandraTableParameters, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.beginMigrateToManualThroughputCassandraKeyspace(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginCreateUpdateCassandraTableDelegate(response); + ServiceResponse clientResponse = beginMigrateToManualThroughputCassandraKeyspaceDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1314,74 +1290,71 @@ public Observable> call(Response< }); } - private ServiceResponse beginCreateUpdateCassandraTableDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse beginMigrateToManualThroughputCassandraKeyspaceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(ErrorResponseException.class) .build(response); } /** - * Deletes an existing Azure Cosmos DB Cassandra table. + * Lists the Cassandra table under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<CassandraTableGetResultsInner> object if successful. */ - public void deleteCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName) { - deleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().last().body(); + public List listCassandraTables(String resourceGroupName, String accountName, String keyspaceName) { + return listCassandraTablesWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).toBlocking().single().body(); } /** - * Deletes an existing Azure Cosmos DB Cassandra table. + * Lists the Cassandra table under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture deleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); + public ServiceFuture> listCassandraTablesAsync(String resourceGroupName, String accountName, String keyspaceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listCassandraTablesWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName), serviceCallback); } /** - * Deletes an existing Azure Cosmos DB Cassandra table. + * Lists the Cassandra table under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request + * @return the observable to the List<CassandraTableGetResultsInner> object */ - public Observable deleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { - return deleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, Void>() { + public Observable> listCassandraTablesAsync(String resourceGroupName, String accountName, String keyspaceName) { + return listCassandraTablesWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).map(new Func1>, List>() { @Override - public Void call(ServiceResponse response) { + public List call(ServiceResponse> response) { return response.body(); } }); } /** - * Deletes an existing Azure Cosmos DB Cassandra table. + * Lists the Cassandra table under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. - * @param tableName Cosmos DB table name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request + * @return the observable to the List<CassandraTableGetResultsInner> object */ - public Observable> deleteCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + public Observable>> listCassandraTablesWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1394,16 +1367,35 @@ public Observable> deleteCassandraTableWithServiceResponse if (keyspaceName == null) { throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); } - if (tableName == null) { - throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); - } final String apiVersion = "2020-03-01"; - Observable> observable = service.deleteCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return service.listCassandraTables(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listCassandraTablesDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listCassandraTablesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); } /** - * Deletes an existing Azure Cosmos DB Cassandra table. + * Gets the Cassandra table under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1412,13 +1404,14 @@ public Observable> deleteCassandraTableWithServiceResponse * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CassandraTableGetResultsInner object if successful. */ - public void beginDeleteCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName) { - beginDeleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().single().body(); + public CassandraTableGetResultsInner getCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().single().body(); } /** - * Deletes an existing Azure Cosmos DB Cassandra table. + * Gets the Cassandra table under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1428,40 +1421,614 @@ public void beginDeleteCassandraTable(String resourceGroupName, String accountNa * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginDeleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginDeleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); + public ServiceFuture getCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); } /** - * Deletes an existing Azure Cosmos DB Cassandra table. + * Gets the Cassandra table under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. * @param tableName Cosmos DB table name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable to the CassandraTableGetResultsInner object */ - public Observable beginDeleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { - return beginDeleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, Void>() { + public Observable getCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, CassandraTableGetResultsInner>() { @Override - public Void call(ServiceResponse response) { + public CassandraTableGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Deletes an existing Azure Cosmos DB Cassandra table. + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CassandraTableGetResultsInner object + */ + public Observable> getCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.getCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCassandraTableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getCassandraTableDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CassandraTableGetResultsInner object if successful. + */ + public CassandraTableGetResultsInner createUpdateCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return createUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createUpdateCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return createUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).map(new Func1, CassandraTableGetResultsInner>() { + @Override + public CassandraTableGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (createUpdateCassandraTableParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateCassandraTableParameters is required and cannot be null."); + } + Validator.validate(createUpdateCassandraTableParameters); + final String apiVersion = "2020-03-01"; + Observable> observable = service.createUpdateCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, createUpdateCassandraTableParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CassandraTableGetResultsInner object if successful. + */ + public CassandraTableGetResultsInner beginCreateUpdateCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return beginCreateUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateUpdateCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CassandraTableGetResultsInner object + */ + public Observable beginCreateUpdateCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return beginCreateUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).map(new Func1, CassandraTableGetResultsInner>() { + @Override + public CassandraTableGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CassandraTableGetResultsInner object + */ + public Observable> beginCreateUpdateCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (createUpdateCassandraTableParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateCassandraTableParameters is required and cannot be null."); + } + Validator.validate(createUpdateCassandraTableParameters); + final String apiVersion = "2020-03-01"; + return service.beginCreateUpdateCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, createUpdateCassandraTableParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateCassandraTableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateCassandraTableDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + deleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return deleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + Observable> observable = service.deleteCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDeleteCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + beginDeleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginDeleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.beginDeleteCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteCassandraTableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteCassandraTableDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner getCassandraTableThroughput(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().single().body(); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable getCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> getCassandraTableThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.getCassandraTableThroughput(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCassandraTableThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getCassandraTableThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner updateCassandraTableThroughput(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).toBlocking().last().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable for the request */ - public Observable> beginDeleteCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + public Observable> updateCassandraTableThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1477,13 +2044,106 @@ public Observable> beginDeleteCassandraTableWithServiceRes if (tableName == null) { throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); final String apiVersion = "2020-03-01"; - return service.beginDeleteCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Observable> observable = service.updateCassandraTableThroughput(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginUpdateCassandraTableThroughput(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).toBlocking().single().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginUpdateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginUpdateCassandraTableThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2020-03-01"; + return service.beginUpdateCassandraTableThroughput(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginDeleteCassandraTableDelegate(response); + ServiceResponse clientResponse = beginUpdateCassandraTableThroughputDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1492,32 +2152,32 @@ public Observable> call(Response response) { }); } - private ServiceResponse beginDeleteCassandraTableDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginUpdateCassandraTableThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) - .register(204, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } /** - * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. * @param tableName Cosmos DB table name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ - public ThroughputSettingsGetResultsInner getCassandraTableThroughput(String resourceGroupName, String accountName, String keyspaceName, String tableName) { - return getCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner migrateToAutoscaleCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return migrateToAutoscaleCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().last().body(); } /** - * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1527,12 +2187,93 @@ public ThroughputSettingsGetResultsInner getCassandraTableThroughput(String reso * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); + public ServiceFuture migrateToAutoscaleCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToAutoscaleCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); } /** - * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable migrateToAutoscaleCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return migrateToAutoscaleCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> migrateToAutoscaleCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + Observable> observable = service.migrateToAutoscaleCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginMigrateToAutoscaleCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginMigrateToAutoscaleCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().single().body(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginMigrateToAutoscaleCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToAutoscaleCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); + } + + /** + * Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1541,8 +2282,8 @@ public ServiceFuture getCassandraTableThrough * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable getCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { - return getCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, ThroughputSettingsGetResultsInner>() { + public Observable beginMigrateToAutoscaleCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginMigrateToAutoscaleCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); @@ -1551,7 +2292,7 @@ public ThroughputSettingsGetResultsInner call(ServiceResponse> getCassandraTableThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + public Observable> beginMigrateToAutoscaleCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1577,12 +2318,12 @@ public Observable> getCassand throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); } final String apiVersion = "2020-03-01"; - return service.getCassandraTableThroughput(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.beginMigrateToAutoscaleCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = getCassandraTableThroughputDelegate(response); + ServiceResponse clientResponse = beginMigrateToAutoscaleCassandraTableDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1591,59 +2332,57 @@ public Observable> call(Respo }); } - private ServiceResponse getCassandraTableThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginMigrateToAutoscaleCassandraTableDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) .build(response); } /** - * Update RUs per second of an Azure Cosmos DB Cassandra table. + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. * @param tableName Cosmos DB table name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ - public ThroughputSettingsGetResultsInner updateCassandraTableThroughput(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return updateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).toBlocking().last().body(); + public ThroughputSettingsGetResultsInner migrateToManualThroughputCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return migrateToManualThroughputCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().last().body(); } /** - * Update RUs per second of an Azure Cosmos DB Cassandra table. + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. * @param tableName Cosmos DB table name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters), serviceCallback); + public ServiceFuture migrateToManualThroughputCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToManualThroughputCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); } /** - * Update RUs per second of an Azure Cosmos DB Cassandra table. + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. * @param tableName Cosmos DB table name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable updateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return updateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + public Observable migrateToManualThroughputCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return migrateToManualThroughputCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); @@ -1652,17 +2391,16 @@ public ThroughputSettingsGetResultsInner call(ServiceResponse> updateCassandraTableThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + public Observable> migrateToManualThroughputCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1678,61 +2416,54 @@ public Observable> updateCass if (tableName == null) { throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); } - if (updateThroughputParameters == null) { - throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); - } - Validator.validate(updateThroughputParameters); final String apiVersion = "2020-03-01"; - Observable> observable = service.updateCassandraTableThroughput(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + Observable> observable = service.migrateToManualThroughputCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Update RUs per second of an Azure Cosmos DB Cassandra table. + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. * @param tableName Cosmos DB table name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ - public ThroughputSettingsGetResultsInner beginUpdateCassandraTableThroughput(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return beginUpdateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner beginMigrateToManualThroughputCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginMigrateToManualThroughputCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().single().body(); } /** - * Update RUs per second of an Azure Cosmos DB Cassandra table. + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. * @param tableName Cosmos DB table name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginUpdateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginUpdateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters), serviceCallback); + public ServiceFuture beginMigrateToManualThroughputCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToManualThroughputCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); } /** - * Update RUs per second of an Azure Cosmos DB Cassandra table. + * Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param keyspaceName Cosmos DB keyspace name. * @param tableName Cosmos DB table name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable beginUpdateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return beginUpdateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + public Observable beginMigrateToManualThroughputCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginMigrateToManualThroughputCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); @@ -1741,17 +2472,16 @@ public ThroughputSettingsGetResultsInner call(ServiceResponse> beginUpdateCassandraTableThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + public Observable> beginMigrateToManualThroughputCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1767,17 +2497,13 @@ public Observable> beginUpdat if (tableName == null) { throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); } - if (updateThroughputParameters == null) { - throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); - } - Validator.validate(updateThroughputParameters); final String apiVersion = "2020-03-01"; - return service.beginUpdateCassandraTableThroughput(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.beginMigrateToManualThroughputCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginUpdateCassandraTableThroughputDelegate(response); + ServiceResponse clientResponse = beginMigrateToManualThroughputCassandraTableDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1786,11 +2512,11 @@ public Observable> call(Respo }); } - private ServiceResponse beginUpdateCassandraTableThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginMigrateToManualThroughputCassandraTableDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(ErrorResponseException.class) .build(response); } diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/GremlinResourcesImpl.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/GremlinResourcesImpl.java index b16695e9caed1..5b22b9ac59156 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/GremlinResourcesImpl.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/GremlinResourcesImpl.java @@ -139,6 +139,30 @@ public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner }); } + @Override + public Observable migrateToAutoscaleGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + GremlinResourcesInner client = this.inner(); + return client.migrateToAutoscaleGremlinDatabaseAsync(resourceGroupName, accountName, databaseName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable migrateToManualThroughputGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + GremlinResourcesInner client = this.inner(); + return client.migrateToManualThroughputGremlinDatabaseAsync(resourceGroupName, accountName, databaseName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + @Override public Observable getGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { GremlinResourcesInner client = this.inner(); @@ -163,6 +187,30 @@ public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner }); } + @Override + public Observable migrateToAutoscaleGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + GremlinResourcesInner client = this.inner(); + return client.migrateToAutoscaleGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable migrateToManualThroughputGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + GremlinResourcesInner client = this.inner(); + return client.migrateToManualThroughputGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + @Override public Observable getGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { GremlinResourcesInner client = this.inner(); diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/GremlinResourcesInner.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/GremlinResourcesInner.java index c069e5986559c..0c2f6596b7d03 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/GremlinResourcesInner.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/GremlinResourcesInner.java @@ -11,6 +11,7 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.cosmosdb.v2020_03_01.ErrorResponseException; import com.microsoft.azure.management.cosmosdb.v2020_03_01.GremlinDatabaseCreateUpdateParameters; import com.microsoft.azure.management.cosmosdb.v2020_03_01.GremlinGraphCreateUpdateParameters; import com.microsoft.azure.management.cosmosdb.v2020_03_01.ThroughputSettingsUpdateParameters; @@ -27,6 +28,7 @@ import retrofit2.http.Headers; import retrofit2.http.HTTP; import retrofit2.http.Path; +import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Query; import retrofit2.Response; @@ -95,6 +97,22 @@ interface GremlinResourcesService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default") Observable> beginUpdateGremlinDatabaseThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.GremlinResources migrateToAutoscaleGremlinDatabase" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale") + Observable> migrateToAutoscaleGremlinDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.GremlinResources beginMigrateToAutoscaleGremlinDatabase" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale") + Observable> beginMigrateToAutoscaleGremlinDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.GremlinResources migrateToManualThroughputGremlinDatabase" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput") + Observable> migrateToManualThroughputGremlinDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.GremlinResources beginMigrateToManualThroughputGremlinDatabase" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput") + Observable> beginMigrateToManualThroughputGremlinDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.GremlinResources listGremlinGraphs" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs") Observable> listGremlinGraphs(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -131,6 +149,22 @@ interface GremlinResourcesService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default") Observable> beginUpdateGremlinGraphThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("graphName") String graphName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.GremlinResources migrateToAutoscaleGremlinGraph" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale") + Observable> migrateToAutoscaleGremlinGraph(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("graphName") String graphName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.GremlinResources beginMigrateToAutoscaleGremlinGraph" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale") + Observable> beginMigrateToAutoscaleGremlinGraph(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("graphName") String graphName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.GremlinResources migrateToManualThroughputGremlinGraph" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput") + Observable> migrateToManualThroughputGremlinGraph(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("graphName") String graphName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.GremlinResources beginMigrateToManualThroughputGremlinGraph" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput") + Observable> beginMigrateToManualThroughputGremlinGraph(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("graphName") String graphName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -758,7 +792,7 @@ private ServiceResponse getGremlinDatabaseThr * @param databaseName Cosmos DB database name. * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin database. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ @@ -840,7 +874,7 @@ public Observable> updateGrem * @param databaseName Cosmos DB database name. * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin database. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ @@ -924,31 +958,31 @@ public Observable> call(Respo }); } - private ServiceResponse beginUpdateGremlinDatabaseThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginUpdateGremlinDatabaseThroughputDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(ErrorResponseException.class) .build(response); } /** - * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<GremlinGraphGetResultsInner> object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public List listGremlinGraphs(String resourceGroupName, String accountName, String databaseName) { - return listGremlinGraphsWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner migrateToAutoscaleGremlinDatabase(String resourceGroupName, String accountName, String databaseName) { + return migrateToAutoscaleGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().last().body(); } /** - * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -957,38 +991,38 @@ public List listGremlinGraphs(String resourceGroupN * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listGremlinGraphsAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listGremlinGraphsWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + public ServiceFuture migrateToAutoscaleGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToAutoscaleGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<GremlinGraphGetResultsInner> object + * @return the observable for the request */ - public Observable> listGremlinGraphsAsync(String resourceGroupName, String accountName, String databaseName) { - return listGremlinGraphsWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1>, List>() { + public Observable migrateToAutoscaleGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return migrateToAutoscaleGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public List call(ServiceResponse> response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<GremlinGraphGetResultsInner> object + * @return the observable for the request */ - public Observable>> listGremlinGraphsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + public Observable> migrateToAutoscaleGremlinDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1002,93 +1036,67 @@ public Observable>> listGremli throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } final String apiVersion = "2020-03-01"; - return service.listGremlinGraphs(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listGremlinGraphsDelegate(response); - List items = null; - if (result.body() != null) { - items = result.body().items(); - } - ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> listGremlinGraphsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) - .build(response); + Observable> observable = service.migrateToAutoscaleGremlinDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the GremlinGraphGetResultsInner object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public GremlinGraphGetResultsInner getGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName) { - return getGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner beginMigrateToAutoscaleGremlinDatabase(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateToAutoscaleGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); } /** - * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); + public ServiceFuture beginMigrateToAutoscaleGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToAutoscaleGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the GremlinGraphGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable getGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { - return getGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, GremlinGraphGetResultsInner>() { + public Observable beginMigrateToAutoscaleGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateToAutoscaleGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public GremlinGraphGetResultsInner call(ServiceResponse response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the GremlinGraphGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable> getGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + public Observable> beginMigrateToAutoscaleGremlinDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1101,16 +1109,13 @@ public Observable> getGremlinGraphW if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - if (graphName == null) { - throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); - } final String apiVersion = "2020-03-01"; - return service.getGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.beginMigrateToAutoscaleGremlinDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getGremlinGraphDelegate(response); + ServiceResponse clientResponse = beginMigrateToAutoscaleGremlinDatabaseDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1119,78 +1124,71 @@ public Observable> call(Response getGremlinGraphDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse beginMigrateToAutoscaleGremlinDatabaseDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) .build(response); } /** - * Create or update an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. - * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the GremlinGraphGetResultsInner object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public GremlinGraphGetResultsInner createUpdateGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { - return createUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).toBlocking().last().body(); + public ThroughputSettingsGetResultsInner migrateToManualThroughputGremlinDatabase(String resourceGroupName, String accountName, String databaseName) { + return migrateToManualThroughputGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().last().body(); } /** - * Create or update an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. - * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createUpdateGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters), serviceCallback); + public ServiceFuture migrateToManualThroughputGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToManualThroughputGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Create or update an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. - * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable createUpdateGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { - return createUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).map(new Func1, GremlinGraphGetResultsInner>() { + public Observable migrateToManualThroughputGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return migrateToManualThroughputGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public GremlinGraphGetResultsInner call(ServiceResponse response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Create or update an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. - * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> createUpdateGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + public Observable> migrateToManualThroughputGremlinDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1203,83 +1201,68 @@ public Observable> createUpdateGrem if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - if (graphName == null) { - throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); - } - if (createUpdateGremlinGraphParameters == null) { - throw new IllegalArgumentException("Parameter createUpdateGremlinGraphParameters is required and cannot be null."); - } - Validator.validate(createUpdateGremlinGraphParameters); final String apiVersion = "2020-03-01"; - Observable> observable = service.createUpdateGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, createUpdateGremlinGraphParameters, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + Observable> observable = service.migrateToManualThroughputGremlinDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Create or update an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. - * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the GremlinGraphGetResultsInner object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public GremlinGraphGetResultsInner beginCreateUpdateGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { - return beginCreateUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner beginMigrateToManualThroughputGremlinDatabase(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateToManualThroughputGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); } /** - * Create or update an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. - * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginCreateUpdateGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginCreateUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters), serviceCallback); + public ServiceFuture beginMigrateToManualThroughputGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToManualThroughputGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Create or update an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. - * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the GremlinGraphGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable beginCreateUpdateGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { - return beginCreateUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).map(new Func1, GremlinGraphGetResultsInner>() { + public Observable beginMigrateToManualThroughputGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateToManualThroughputGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public GremlinGraphGetResultsInner call(ServiceResponse response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Create or update an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. - * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the GremlinGraphGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable> beginCreateUpdateGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + public Observable> beginMigrateToManualThroughputGremlinDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1292,20 +1275,13 @@ public Observable> beginCreateUpdat if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - if (graphName == null) { - throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); - } - if (createUpdateGremlinGraphParameters == null) { - throw new IllegalArgumentException("Parameter createUpdateGremlinGraphParameters is required and cannot be null."); - } - Validator.validate(createUpdateGremlinGraphParameters); final String apiVersion = "2020-03-01"; - return service.beginCreateUpdateGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, createUpdateGremlinGraphParameters, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.beginMigrateToManualThroughputGremlinDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginCreateUpdateGremlinGraphDelegate(response); + ServiceResponse clientResponse = beginMigrateToManualThroughputGremlinDatabaseDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1314,74 +1290,71 @@ public Observable> call(Response beginCreateUpdateGremlinGraphDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse beginMigrateToManualThroughputGremlinDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } /** - * Deletes an existing Azure Cosmos DB Gremlin graph. + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<GremlinGraphGetResultsInner> object if successful. */ - public void deleteGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName) { - deleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().last().body(); + public List listGremlinGraphs(String resourceGroupName, String accountName, String databaseName) { + return listGremlinGraphsWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); } /** - * Deletes an existing Azure Cosmos DB Gremlin graph. + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture deleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); + public ServiceFuture> listGremlinGraphsAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listGremlinGraphsWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Deletes an existing Azure Cosmos DB Gremlin graph. + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request + * @return the observable to the List<GremlinGraphGetResultsInner> object */ - public Observable deleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { - return deleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, Void>() { + public Observable> listGremlinGraphsAsync(String resourceGroupName, String accountName, String databaseName) { + return listGremlinGraphsWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1>, List>() { @Override - public Void call(ServiceResponse response) { + public List call(ServiceResponse> response) { return response.body(); } }); } /** - * Deletes an existing Azure Cosmos DB Gremlin graph. + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param graphName Cosmos DB graph name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request + * @return the observable to the List<GremlinGraphGetResultsInner> object */ - public Observable> deleteGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + public Observable>> listGremlinGraphsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1394,16 +1367,35 @@ public Observable> deleteGremlinGraphWithServiceResponseAs if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - if (graphName == null) { - throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); - } final String apiVersion = "2020-03-01"; - Observable> observable = service.deleteGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return service.listGremlinGraphs(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listGremlinGraphsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listGremlinGraphsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); } /** - * Deletes an existing Azure Cosmos DB Gremlin graph. + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1412,13 +1404,14 @@ public Observable> deleteGremlinGraphWithServiceResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GremlinGraphGetResultsInner object if successful. */ - public void beginDeleteGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName) { - beginDeleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().single().body(); + public GremlinGraphGetResultsInner getGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().single().body(); } /** - * Deletes an existing Azure Cosmos DB Gremlin graph. + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1428,40 +1421,614 @@ public void beginDeleteGremlinGraph(String resourceGroupName, String accountName * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginDeleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginDeleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); + public ServiceFuture getGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); } /** - * Deletes an existing Azure Cosmos DB Gremlin graph. + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param graphName Cosmos DB graph name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable to the GremlinGraphGetResultsInner object */ - public Observable beginDeleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { - return beginDeleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, Void>() { + public Observable getGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, GremlinGraphGetResultsInner>() { @Override - public Void call(ServiceResponse response) { + public GremlinGraphGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GremlinGraphGetResultsInner object + */ + public Observable> getGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.getGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getGremlinGraphDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getGremlinGraphDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GremlinGraphGetResultsInner object if successful. + */ + public GremlinGraphGetResultsInner createUpdateGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return createUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createUpdateGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return createUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).map(new Func1, GremlinGraphGetResultsInner>() { + @Override + public GremlinGraphGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + if (createUpdateGremlinGraphParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateGremlinGraphParameters is required and cannot be null."); + } + Validator.validate(createUpdateGremlinGraphParameters); + final String apiVersion = "2020-03-01"; + Observable> observable = service.createUpdateGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, createUpdateGremlinGraphParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GremlinGraphGetResultsInner object if successful. + */ + public GremlinGraphGetResultsInner beginCreateUpdateGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return beginCreateUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateUpdateGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GremlinGraphGetResultsInner object + */ + public Observable beginCreateUpdateGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return beginCreateUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).map(new Func1, GremlinGraphGetResultsInner>() { + @Override + public GremlinGraphGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GremlinGraphGetResultsInner object + */ + public Observable> beginCreateUpdateGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + if (createUpdateGremlinGraphParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateGremlinGraphParameters is required and cannot be null."); + } + Validator.validate(createUpdateGremlinGraphParameters); + final String apiVersion = "2020-03-01"; + return service.beginCreateUpdateGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, createUpdateGremlinGraphParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateGremlinGraphDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateGremlinGraphDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName) { + deleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + return deleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + Observable> observable = service.deleteGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDeleteGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName) { + beginDeleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginDeleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.beginDeleteGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteGremlinGraphDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteGremlinGraphDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner getGremlinGraphThroughput(String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().single().body(); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable getGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> getGremlinGraphThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.getGremlinGraphThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getGremlinGraphThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getGremlinGraphThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner updateGremlinGraphThroughput(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).toBlocking().last().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Deletes an existing Azure Cosmos DB Gremlin graph. + * Update RUs per second of an Azure Cosmos DB Gremlin graph. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable for the request */ - public Observable> beginDeleteGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + public Observable> updateGremlinGraphThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1477,13 +2044,106 @@ public Observable> beginDeleteGremlinGraphWithServiceRespo if (graphName == null) { throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); final String apiVersion = "2020-03-01"; - return service.beginDeleteGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Observable> observable = service.updateGremlinGraphThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginUpdateGremlinGraphThroughput(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).toBlocking().single().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginUpdateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginUpdateGremlinGraphThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2020-03-01"; + return service.beginUpdateGremlinGraphThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginDeleteGremlinGraphDelegate(response); + ServiceResponse clientResponse = beginUpdateGremlinGraphThroughputDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1492,32 +2152,32 @@ public Observable> call(Response response) { }); } - private ServiceResponse beginDeleteGremlinGraphDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginUpdateGremlinGraphThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) - .register(204, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } /** - * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param graphName Cosmos DB graph name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ - public ThroughputSettingsGetResultsInner getGremlinGraphThroughput(String resourceGroupName, String accountName, String databaseName, String graphName) { - return getGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner migrateToAutoscaleGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName) { + return migrateToAutoscaleGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().last().body(); } /** - * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1527,12 +2187,93 @@ public ThroughputSettingsGetResultsInner getGremlinGraphThroughput(String resour * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); + public ServiceFuture migrateToAutoscaleGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToAutoscaleGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); } /** - * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable migrateToAutoscaleGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + return migrateToAutoscaleGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> migrateToAutoscaleGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + Observable> observable = service.migrateToAutoscaleGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginMigrateToAutoscaleGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginMigrateToAutoscaleGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().single().body(); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginMigrateToAutoscaleGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToAutoscaleGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); + } + + /** + * Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1541,8 +2282,8 @@ public ServiceFuture getGremlinGraphThroughpu * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable getGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { - return getGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, ThroughputSettingsGetResultsInner>() { + public Observable beginMigrateToAutoscaleGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginMigrateToAutoscaleGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); @@ -1551,7 +2292,7 @@ public ThroughputSettingsGetResultsInner call(ServiceResponse> getGremlinGraphThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + public Observable> beginMigrateToAutoscaleGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1577,12 +2318,12 @@ public Observable> getGremlin throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); } final String apiVersion = "2020-03-01"; - return service.getGremlinGraphThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.beginMigrateToAutoscaleGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = getGremlinGraphThroughputDelegate(response); + ServiceResponse clientResponse = beginMigrateToAutoscaleGremlinGraphDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1591,59 +2332,57 @@ public Observable> call(Respo }); } - private ServiceResponse getGremlinGraphThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginMigrateToAutoscaleGremlinGraphDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) .build(response); } /** - * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param graphName Cosmos DB graph name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ - public ThroughputSettingsGetResultsInner updateGremlinGraphThroughput(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return updateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).toBlocking().last().body(); + public ThroughputSettingsGetResultsInner migrateToManualThroughputGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName) { + return migrateToManualThroughputGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().last().body(); } /** - * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param graphName Cosmos DB graph name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters), serviceCallback); + public ServiceFuture migrateToManualThroughputGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToManualThroughputGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); } /** - * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param graphName Cosmos DB graph name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable updateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return updateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + public Observable migrateToManualThroughputGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + return migrateToManualThroughputGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); @@ -1652,17 +2391,16 @@ public ThroughputSettingsGetResultsInner call(ServiceResponse> updateGremlinGraphThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + public Observable> migrateToManualThroughputGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1678,61 +2416,54 @@ public Observable> updateGrem if (graphName == null) { throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); } - if (updateThroughputParameters == null) { - throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); - } - Validator.validate(updateThroughputParameters); final String apiVersion = "2020-03-01"; - Observable> observable = service.updateGremlinGraphThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + Observable> observable = service.migrateToManualThroughputGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param graphName Cosmos DB graph name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ - public ThroughputSettingsGetResultsInner beginUpdateGremlinGraphThroughput(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return beginUpdateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner beginMigrateToManualThroughputGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginMigrateToManualThroughputGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().single().body(); } /** - * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param graphName Cosmos DB graph name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginUpdateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginUpdateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters), serviceCallback); + public ServiceFuture beginMigrateToManualThroughputGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToManualThroughputGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); } /** - * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param graphName Cosmos DB graph name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable beginUpdateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return beginUpdateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + public Observable beginMigrateToManualThroughputGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginMigrateToManualThroughputGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); @@ -1741,17 +2472,16 @@ public ThroughputSettingsGetResultsInner call(ServiceResponse> beginUpdateGremlinGraphThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + public Observable> beginMigrateToManualThroughputGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1767,17 +2497,13 @@ public Observable> beginUpdat if (graphName == null) { throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); } - if (updateThroughputParameters == null) { - throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); - } - Validator.validate(updateThroughputParameters); final String apiVersion = "2020-03-01"; - return service.beginUpdateGremlinGraphThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.beginMigrateToManualThroughputGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginUpdateGremlinGraphThroughputDelegate(response); + ServiceResponse clientResponse = beginMigrateToManualThroughputGremlinGraphDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1786,11 +2512,11 @@ public Observable> call(Respo }); } - private ServiceResponse beginUpdateGremlinGraphThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginMigrateToManualThroughputGremlinGraphDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(ErrorResponseException.class) .build(response); } diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/MongoDBResourcesImpl.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/MongoDBResourcesImpl.java index bd187b3a7d5aa..5567d8eae278a 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/MongoDBResourcesImpl.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/MongoDBResourcesImpl.java @@ -139,6 +139,30 @@ public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner }); } + @Override + public Observable migrateToAutoscaleMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + MongoDBResourcesInner client = this.inner(); + return client.migrateToAutoscaleMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable migrateToManualThroughputMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + MongoDBResourcesInner client = this.inner(); + return client.migrateToManualThroughputMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + @Override public Observable getMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { MongoDBResourcesInner client = this.inner(); @@ -163,6 +187,30 @@ public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner }); } + @Override + public Observable migrateToAutoscaleMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + MongoDBResourcesInner client = this.inner(); + return client.migrateToAutoscaleMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable migrateToManualThroughputMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + MongoDBResourcesInner client = this.inner(); + return client.migrateToManualThroughputMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + @Override public Observable getMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { MongoDBResourcesInner client = this.inner(); diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/MongoDBResourcesInner.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/MongoDBResourcesInner.java index c663aef6b8c98..e7df9c410829f 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/MongoDBResourcesInner.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/MongoDBResourcesInner.java @@ -11,6 +11,7 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.cosmosdb.v2020_03_01.ErrorResponseException; import com.microsoft.azure.management.cosmosdb.v2020_03_01.MongoDBCollectionCreateUpdateParameters; import com.microsoft.azure.management.cosmosdb.v2020_03_01.MongoDBDatabaseCreateUpdateParameters; import com.microsoft.azure.management.cosmosdb.v2020_03_01.ThroughputSettingsUpdateParameters; @@ -27,6 +28,7 @@ import retrofit2.http.Headers; import retrofit2.http.HTTP; import retrofit2.http.Path; +import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Query; import retrofit2.Response; @@ -95,6 +97,22 @@ interface MongoDBResourcesService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default") Observable> beginUpdateMongoDBDatabaseThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.MongoDBResources migrateToAutoscaleMongoDBDatabase" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale") + Observable> migrateToAutoscaleMongoDBDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.MongoDBResources beginMigrateToAutoscaleMongoDBDatabase" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale") + Observable> beginMigrateToAutoscaleMongoDBDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.MongoDBResources migrateToManualThroughputMongoDBDatabase" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput") + Observable> migrateToManualThroughputMongoDBDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.MongoDBResources beginMigrateToManualThroughputMongoDBDatabase" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput") + Observable> beginMigrateToManualThroughputMongoDBDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.MongoDBResources listMongoDBCollections" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections") Observable> listMongoDBCollections(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -131,6 +149,22 @@ interface MongoDBResourcesService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default") Observable> beginUpdateMongoDBCollectionThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("collectionName") String collectionName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.MongoDBResources migrateToAutoscaleMongoDBCollection" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale") + Observable> migrateToAutoscaleMongoDBCollection(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("collectionName") String collectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.MongoDBResources beginMigrateToAutoscaleMongoDBCollection" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale") + Observable> beginMigrateToAutoscaleMongoDBCollection(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("collectionName") String collectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.MongoDBResources migrateToManualThroughputMongoDBCollection" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput") + Observable> migrateToManualThroughputMongoDBCollection(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("collectionName") String collectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.MongoDBResources beginMigrateToManualThroughputMongoDBCollection" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput") + Observable> beginMigrateToManualThroughputMongoDBCollection(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("collectionName") String collectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -933,22 +967,22 @@ private ServiceResponse beginUpdateMongoDBDat } /** - * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<MongoDBCollectionGetResultsInner> object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public List listMongoDBCollections(String resourceGroupName, String accountName, String databaseName) { - return listMongoDBCollectionsWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner migrateToAutoscaleMongoDBDatabase(String resourceGroupName, String accountName, String databaseName) { + return migrateToAutoscaleMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().last().body(); } /** - * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -957,38 +991,38 @@ public List listMongoDBCollections(String reso * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listMongoDBCollectionsAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listMongoDBCollectionsWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + public ServiceFuture migrateToAutoscaleMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToAutoscaleMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<MongoDBCollectionGetResultsInner> object + * @return the observable for the request */ - public Observable> listMongoDBCollectionsAsync(String resourceGroupName, String accountName, String databaseName) { - return listMongoDBCollectionsWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1>, List>() { + public Observable migrateToAutoscaleMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return migrateToAutoscaleMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public List call(ServiceResponse> response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<MongoDBCollectionGetResultsInner> object + * @return the observable for the request */ - public Observable>> listMongoDBCollectionsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + public Observable> migrateToAutoscaleMongoDBDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1002,93 +1036,67 @@ public Observable>> listM throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } final String apiVersion = "2020-03-01"; - return service.listMongoDBCollections(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listMongoDBCollectionsDelegate(response); - List items = null; - if (result.body() != null) { - items = result.body().items(); - } - ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> listMongoDBCollectionsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) - .build(response); + Observable> observable = service.migrateToAutoscaleMongoDBDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the MongoDBCollectionGetResultsInner object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public MongoDBCollectionGetResultsInner getMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName) { - return getMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner beginMigrateToAutoscaleMongoDBDatabase(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateToAutoscaleMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); } /** - * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); + public ServiceFuture beginMigrateToAutoscaleMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToAutoscaleMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the MongoDBCollectionGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable getMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { - return getMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, MongoDBCollectionGetResultsInner>() { + public Observable beginMigrateToAutoscaleMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateToAutoscaleMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public MongoDBCollectionGetResultsInner call(ServiceResponse response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the MongoDBCollectionGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable> getMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + public Observable> beginMigrateToAutoscaleMongoDBDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1101,16 +1109,13 @@ public Observable> getMongoDBC if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - if (collectionName == null) { - throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); - } final String apiVersion = "2020-03-01"; - return service.getMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.beginMigrateToAutoscaleMongoDBDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getMongoDBCollectionDelegate(response); + ServiceResponse clientResponse = beginMigrateToAutoscaleMongoDBDatabaseDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1119,78 +1124,71 @@ public Observable> call(Respon }); } - private ServiceResponse getMongoDBCollectionDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse beginMigrateToAutoscaleMongoDBDatabaseDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) .build(response); } /** - * Create or update an Azure Cosmos DB MongoDB Collection. + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. - * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the MongoDBCollectionGetResultsInner object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public MongoDBCollectionGetResultsInner createUpdateMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { - return createUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).toBlocking().last().body(); + public ThroughputSettingsGetResultsInner migrateToManualThroughputMongoDBDatabase(String resourceGroupName, String accountName, String databaseName) { + return migrateToManualThroughputMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().last().body(); } /** - * Create or update an Azure Cosmos DB MongoDB Collection. + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. - * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createUpdateMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters), serviceCallback); + public ServiceFuture migrateToManualThroughputMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToManualThroughputMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Create or update an Azure Cosmos DB MongoDB Collection. + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. - * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable createUpdateMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { - return createUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).map(new Func1, MongoDBCollectionGetResultsInner>() { + public Observable migrateToManualThroughputMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return migrateToManualThroughputMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public MongoDBCollectionGetResultsInner call(ServiceResponse response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Create or update an Azure Cosmos DB MongoDB Collection. + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. - * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> createUpdateMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + public Observable> migrateToManualThroughputMongoDBDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1203,83 +1201,68 @@ public Observable> createUpdat if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - if (collectionName == null) { - throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); - } - if (createUpdateMongoDBCollectionParameters == null) { - throw new IllegalArgumentException("Parameter createUpdateMongoDBCollectionParameters is required and cannot be null."); - } - Validator.validate(createUpdateMongoDBCollectionParameters); final String apiVersion = "2020-03-01"; - Observable> observable = service.createUpdateMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, createUpdateMongoDBCollectionParameters, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + Observable> observable = service.migrateToManualThroughputMongoDBDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Create or update an Azure Cosmos DB MongoDB Collection. + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. - * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the MongoDBCollectionGetResultsInner object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public MongoDBCollectionGetResultsInner beginCreateUpdateMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { - return beginCreateUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner beginMigrateToManualThroughputMongoDBDatabase(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateToManualThroughputMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); } /** - * Create or update an Azure Cosmos DB MongoDB Collection. + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. - * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginCreateUpdateMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginCreateUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters), serviceCallback); + public ServiceFuture beginMigrateToManualThroughputMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToManualThroughputMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Create or update an Azure Cosmos DB MongoDB Collection. + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. - * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the MongoDBCollectionGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable beginCreateUpdateMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { - return beginCreateUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).map(new Func1, MongoDBCollectionGetResultsInner>() { + public Observable beginMigrateToManualThroughputMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateToManualThroughputMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public MongoDBCollectionGetResultsInner call(ServiceResponse response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Create or update an Azure Cosmos DB MongoDB Collection. + * Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. - * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the MongoDBCollectionGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable> beginCreateUpdateMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + public Observable> beginMigrateToManualThroughputMongoDBDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1292,20 +1275,13 @@ public Observable> beginCreate if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - if (collectionName == null) { - throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); - } - if (createUpdateMongoDBCollectionParameters == null) { - throw new IllegalArgumentException("Parameter createUpdateMongoDBCollectionParameters is required and cannot be null."); - } - Validator.validate(createUpdateMongoDBCollectionParameters); final String apiVersion = "2020-03-01"; - return service.beginCreateUpdateMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, createUpdateMongoDBCollectionParameters, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.beginMigrateToManualThroughputMongoDBDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginCreateUpdateMongoDBCollectionDelegate(response); + ServiceResponse clientResponse = beginMigrateToManualThroughputMongoDBDatabaseDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1314,74 +1290,71 @@ public Observable> call(Respon }); } - private ServiceResponse beginCreateUpdateMongoDBCollectionDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse beginMigrateToManualThroughputMongoDBDatabaseDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(ErrorResponseException.class) .build(response); } /** - * Deletes an existing Azure Cosmos DB MongoDB Collection. + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<MongoDBCollectionGetResultsInner> object if successful. */ - public void deleteMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName) { - deleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().last().body(); + public List listMongoDBCollections(String resourceGroupName, String accountName, String databaseName) { + return listMongoDBCollectionsWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); } /** - * Deletes an existing Azure Cosmos DB MongoDB Collection. + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture deleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); + public ServiceFuture> listMongoDBCollectionsAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMongoDBCollectionsWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Deletes an existing Azure Cosmos DB MongoDB Collection. + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request + * @return the observable to the List<MongoDBCollectionGetResultsInner> object */ - public Observable deleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { - return deleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, Void>() { + public Observable> listMongoDBCollectionsAsync(String resourceGroupName, String accountName, String databaseName) { + return listMongoDBCollectionsWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1>, List>() { @Override - public Void call(ServiceResponse response) { + public List call(ServiceResponse> response) { return response.body(); } }); } /** - * Deletes an existing Azure Cosmos DB MongoDB Collection. + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param collectionName Cosmos DB collection name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request + * @return the observable to the List<MongoDBCollectionGetResultsInner> object */ - public Observable> deleteMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + public Observable>> listMongoDBCollectionsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1394,16 +1367,35 @@ public Observable> deleteMongoDBCollectionWithServiceRespo if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - if (collectionName == null) { - throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); - } final String apiVersion = "2020-03-01"; - Observable> observable = service.deleteMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return service.listMongoDBCollections(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMongoDBCollectionsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMongoDBCollectionsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); } /** - * Deletes an existing Azure Cosmos DB MongoDB Collection. + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1412,13 +1404,14 @@ public Observable> deleteMongoDBCollectionWithServiceRespo * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MongoDBCollectionGetResultsInner object if successful. */ - public void beginDeleteMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName) { - beginDeleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().single().body(); + public MongoDBCollectionGetResultsInner getMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().single().body(); } /** - * Deletes an existing Azure Cosmos DB MongoDB Collection. + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1428,40 +1421,614 @@ public void beginDeleteMongoDBCollection(String resourceGroupName, String accoun * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginDeleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginDeleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); + public ServiceFuture getMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); } /** - * Deletes an existing Azure Cosmos DB MongoDB Collection. + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param collectionName Cosmos DB collection name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable to the MongoDBCollectionGetResultsInner object */ - public Observable beginDeleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { - return beginDeleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, Void>() { + public Observable getMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, MongoDBCollectionGetResultsInner>() { @Override - public Void call(ServiceResponse response) { + public MongoDBCollectionGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Deletes an existing Azure Cosmos DB MongoDB Collection. + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MongoDBCollectionGetResultsInner object + */ + public Observable> getMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.getMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getMongoDBCollectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getMongoDBCollectionDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MongoDBCollectionGetResultsInner object if successful. + */ + public MongoDBCollectionGetResultsInner createUpdateMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return createUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createUpdateMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return createUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).map(new Func1, MongoDBCollectionGetResultsInner>() { + @Override + public MongoDBCollectionGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + if (createUpdateMongoDBCollectionParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateMongoDBCollectionParameters is required and cannot be null."); + } + Validator.validate(createUpdateMongoDBCollectionParameters); + final String apiVersion = "2020-03-01"; + Observable> observable = service.createUpdateMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, createUpdateMongoDBCollectionParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MongoDBCollectionGetResultsInner object if successful. + */ + public MongoDBCollectionGetResultsInner beginCreateUpdateMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return beginCreateUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateUpdateMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MongoDBCollectionGetResultsInner object + */ + public Observable beginCreateUpdateMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return beginCreateUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).map(new Func1, MongoDBCollectionGetResultsInner>() { + @Override + public MongoDBCollectionGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MongoDBCollectionGetResultsInner object + */ + public Observable> beginCreateUpdateMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + if (createUpdateMongoDBCollectionParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateMongoDBCollectionParameters is required and cannot be null."); + } + Validator.validate(createUpdateMongoDBCollectionParameters); + final String apiVersion = "2020-03-01"; + return service.beginCreateUpdateMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, createUpdateMongoDBCollectionParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateMongoDBCollectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateMongoDBCollectionDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName) { + deleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return deleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + Observable> observable = service.deleteMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDeleteMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName) { + beginDeleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginDeleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.beginDeleteMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteMongoDBCollectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteMongoDBCollectionDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner getMongoDBCollectionThroughput(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().single().body(); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable getMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> getMongoDBCollectionThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.getMongoDBCollectionThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getMongoDBCollectionThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getMongoDBCollectionThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner updateMongoDBCollectionThroughput(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).toBlocking().last().body(); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters), serviceCallback); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable for the request */ - public Observable> beginDeleteMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + public Observable> updateMongoDBCollectionThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1477,13 +2044,106 @@ public Observable> beginDeleteMongoDBCollectionWithService if (collectionName == null) { throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); final String apiVersion = "2020-03-01"; - return service.beginDeleteMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Observable> observable = service.updateMongoDBCollectionThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginUpdateMongoDBCollectionThroughput(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).toBlocking().single().body(); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters), serviceCallback); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginUpdateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginUpdateMongoDBCollectionThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2020-03-01"; + return service.beginUpdateMongoDBCollectionThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginDeleteMongoDBCollectionDelegate(response); + ServiceResponse clientResponse = beginUpdateMongoDBCollectionThroughputDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1492,32 +2152,32 @@ public Observable> call(Response response) { }); } - private ServiceResponse beginDeleteMongoDBCollectionDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginUpdateMongoDBCollectionThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) - .register(204, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } /** - * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param collectionName Cosmos DB collection name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ - public ThroughputSettingsGetResultsInner getMongoDBCollectionThroughput(String resourceGroupName, String accountName, String databaseName, String collectionName) { - return getMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner migrateToAutoscaleMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return migrateToAutoscaleMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().last().body(); } /** - * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1527,12 +2187,93 @@ public ThroughputSettingsGetResultsInner getMongoDBCollectionThroughput(String r * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); + public ServiceFuture migrateToAutoscaleMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToAutoscaleMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); } /** - * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable migrateToAutoscaleMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return migrateToAutoscaleMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> migrateToAutoscaleMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + Observable> observable = service.migrateToAutoscaleMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginMigrateToAutoscaleMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginMigrateToAutoscaleMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().single().body(); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginMigrateToAutoscaleMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToAutoscaleMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); + } + + /** + * Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1541,8 +2282,8 @@ public ServiceFuture getMongoDBCollectionThro * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable getMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { - return getMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, ThroughputSettingsGetResultsInner>() { + public Observable beginMigrateToAutoscaleMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginMigrateToAutoscaleMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); @@ -1551,7 +2292,7 @@ public ThroughputSettingsGetResultsInner call(ServiceResponse> getMongoDBCollectionThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + public Observable> beginMigrateToAutoscaleMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1577,12 +2318,12 @@ public Observable> getMongoDB throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); } final String apiVersion = "2020-03-01"; - return service.getMongoDBCollectionThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.beginMigrateToAutoscaleMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = getMongoDBCollectionThroughputDelegate(response); + ServiceResponse clientResponse = beginMigrateToAutoscaleMongoDBCollectionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1591,59 +2332,57 @@ public Observable> call(Respo }); } - private ServiceResponse getMongoDBCollectionThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginMigrateToAutoscaleMongoDBCollectionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) .build(response); } /** - * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param collectionName Cosmos DB collection name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ - public ThroughputSettingsGetResultsInner updateMongoDBCollectionThroughput(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return updateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).toBlocking().last().body(); + public ThroughputSettingsGetResultsInner migrateToManualThroughputMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return migrateToManualThroughputMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().last().body(); } /** - * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param collectionName Cosmos DB collection name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters), serviceCallback); + public ServiceFuture migrateToManualThroughputMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToManualThroughputMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); } /** - * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param collectionName Cosmos DB collection name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable updateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return updateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + public Observable migrateToManualThroughputMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return migrateToManualThroughputMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); @@ -1652,17 +2391,16 @@ public ThroughputSettingsGetResultsInner call(ServiceResponse> updateMongoDBCollectionThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + public Observable> migrateToManualThroughputMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1678,61 +2416,54 @@ public Observable> updateMong if (collectionName == null) { throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); } - if (updateThroughputParameters == null) { - throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); - } - Validator.validate(updateThroughputParameters); final String apiVersion = "2020-03-01"; - Observable> observable = service.updateMongoDBCollectionThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + Observable> observable = service.migrateToManualThroughputMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param collectionName Cosmos DB collection name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ - public ThroughputSettingsGetResultsInner beginUpdateMongoDBCollectionThroughput(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return beginUpdateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner beginMigrateToManualThroughputMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginMigrateToManualThroughputMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().single().body(); } /** - * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param collectionName Cosmos DB collection name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginUpdateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginUpdateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters), serviceCallback); + public ServiceFuture beginMigrateToManualThroughputMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToManualThroughputMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); } /** - * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param collectionName Cosmos DB collection name. - * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable beginUpdateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return beginUpdateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + public Observable beginMigrateToManualThroughputMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginMigrateToManualThroughputMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); @@ -1741,17 +2472,16 @@ public ThroughputSettingsGetResultsInner call(ServiceResponse> beginUpdateMongoDBCollectionThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + public Observable> beginMigrateToManualThroughputMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1767,17 +2497,13 @@ public Observable> beginUpdat if (collectionName == null) { throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); } - if (updateThroughputParameters == null) { - throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); - } - Validator.validate(updateThroughputParameters); final String apiVersion = "2020-03-01"; - return service.beginUpdateMongoDBCollectionThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.beginMigrateToManualThroughputMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginUpdateMongoDBCollectionThroughputDelegate(response); + ServiceResponse clientResponse = beginMigrateToManualThroughputMongoDBCollectionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1786,11 +2512,11 @@ public Observable> call(Respo }); } - private ServiceResponse beginUpdateMongoDBCollectionThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginMigrateToManualThroughputMongoDBCollectionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(ErrorResponseException.class) .build(response); } diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/SqlResourcesImpl.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/SqlResourcesImpl.java index 374fbe8f4ce1d..c2f7916d4de80 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/SqlResourcesImpl.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/SqlResourcesImpl.java @@ -211,6 +211,30 @@ public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner }); } + @Override + public Observable migrateToAutoscaleSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + SqlResourcesInner client = this.inner(); + return client.migrateToAutoscaleSqlDatabaseAsync(resourceGroupName, accountName, databaseName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable migrateToManualThroughputSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + SqlResourcesInner client = this.inner(); + return client.migrateToManualThroughputSqlDatabaseAsync(resourceGroupName, accountName, databaseName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + @Override public Observable getSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { SqlResourcesInner client = this.inner(); @@ -235,6 +259,30 @@ public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner }); } + @Override + public Observable migrateToAutoscaleSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + SqlResourcesInner client = this.inner(); + return client.migrateToAutoscaleSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable migrateToManualThroughputSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + SqlResourcesInner client = this.inner(); + return client.migrateToManualThroughputSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + @Override public Observable getSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { SqlResourcesInner client = this.inner(); diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/SqlResourcesInner.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/SqlResourcesInner.java index e86a8cb5ca655..38511b5ae2628 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/SqlResourcesInner.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/SqlResourcesInner.java @@ -11,6 +11,7 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.cosmosdb.v2020_03_01.ErrorResponseException; import com.microsoft.azure.management.cosmosdb.v2020_03_01.SqlContainerCreateUpdateParameters; import com.microsoft.azure.management.cosmosdb.v2020_03_01.SqlDatabaseCreateUpdateParameters; import com.microsoft.azure.management.cosmosdb.v2020_03_01.SqlStoredProcedureCreateUpdateParameters; @@ -30,6 +31,7 @@ import retrofit2.http.Headers; import retrofit2.http.HTTP; import retrofit2.http.Path; +import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Query; import retrofit2.Response; @@ -98,6 +100,22 @@ interface SqlResourcesService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default") Observable> beginUpdateSqlDatabaseThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.SqlResources migrateToAutoscaleSqlDatabase" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale") + Observable> migrateToAutoscaleSqlDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.SqlResources beginMigrateToAutoscaleSqlDatabase" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale") + Observable> beginMigrateToAutoscaleSqlDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.SqlResources migrateToManualThroughputSqlDatabase" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput") + Observable> migrateToManualThroughputSqlDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.SqlResources beginMigrateToManualThroughputSqlDatabase" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput") + Observable> beginMigrateToManualThroughputSqlDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.SqlResources listSqlContainers" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers") Observable> listSqlContainers(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -134,6 +152,22 @@ interface SqlResourcesService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default") Observable> beginUpdateSqlContainerThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.SqlResources migrateToAutoscaleSqlContainer" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale") + Observable> migrateToAutoscaleSqlContainer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.SqlResources beginMigrateToAutoscaleSqlContainer" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale") + Observable> beginMigrateToAutoscaleSqlContainer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.SqlResources migrateToManualThroughputSqlContainer" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput") + Observable> migrateToManualThroughputSqlContainer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.SqlResources beginMigrateToManualThroughputSqlContainer" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput") + Observable> beginMigrateToManualThroughputSqlContainer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.SqlResources listSqlStoredProcedures" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures") Observable> listSqlStoredProcedures(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -1008,22 +1042,22 @@ private ServiceResponse beginUpdateSqlDatabas } /** - * Lists the SQL container under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<SqlContainerGetResultsInner> object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public List listSqlContainers(String resourceGroupName, String accountName, String databaseName) { - return listSqlContainersWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner migrateToAutoscaleSqlDatabase(String resourceGroupName, String accountName, String databaseName) { + return migrateToAutoscaleSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().last().body(); } /** - * Lists the SQL container under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1032,38 +1066,38 @@ public List listSqlContainers(String resourceGroupN * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listSqlContainersAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listSqlContainersWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + public ServiceFuture migrateToAutoscaleSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToAutoscaleSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Lists the SQL container under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<SqlContainerGetResultsInner> object + * @return the observable for the request */ - public Observable> listSqlContainersAsync(String resourceGroupName, String accountName, String databaseName) { - return listSqlContainersWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1>, List>() { + public Observable migrateToAutoscaleSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return migrateToAutoscaleSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public List call(ServiceResponse> response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Lists the SQL container under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<SqlContainerGetResultsInner> object + * @return the observable for the request */ - public Observable>> listSqlContainersWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + public Observable> migrateToAutoscaleSqlDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1077,93 +1111,67 @@ public Observable>> listSqlCon throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } final String apiVersion = "2020-03-01"; - return service.listSqlContainers(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listSqlContainersDelegate(response); - List items = null; - if (result.body() != null) { - items = result.body().items(); - } - ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> listSqlContainersDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) - .build(response); + Observable> observable = service.migrateToAutoscaleSqlDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Gets the SQL container under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the SqlContainerGetResultsInner object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public SqlContainerGetResultsInner getSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { - return getSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner beginMigrateToAutoscaleSqlDatabase(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateToAutoscaleSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); } /** - * Gets the SQL container under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + public ServiceFuture beginMigrateToAutoscaleSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToAutoscaleSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Gets the SQL container under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the SqlContainerGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable getSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { - return getSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, SqlContainerGetResultsInner>() { + public Observable beginMigrateToAutoscaleSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateToAutoscaleSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public SqlContainerGetResultsInner call(ServiceResponse response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Gets the SQL container under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the SqlContainerGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable> getSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + public Observable> beginMigrateToAutoscaleSqlDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1176,16 +1184,13 @@ public Observable> getSqlContainerW if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - if (containerName == null) { - throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); - } final String apiVersion = "2020-03-01"; - return service.getSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.beginMigrateToAutoscaleSqlDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getSqlContainerDelegate(response); + ServiceResponse clientResponse = beginMigrateToAutoscaleSqlDatabaseDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1194,78 +1199,71 @@ public Observable> call(Response getSqlContainerDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse beginMigrateToAutoscaleSqlDatabaseDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) .build(response); } /** - * Create or update an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. - * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the SqlContainerGetResultsInner object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public SqlContainerGetResultsInner createUpdateSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { - return createUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).toBlocking().last().body(); + public ThroughputSettingsGetResultsInner migrateToManualThroughputSqlDatabase(String resourceGroupName, String accountName, String databaseName) { + return migrateToManualThroughputSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().last().body(); } /** - * Create or update an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. - * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createUpdateSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters), serviceCallback); + public ServiceFuture migrateToManualThroughputSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToManualThroughputSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Create or update an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. - * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable createUpdateSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { - return createUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).map(new Func1, SqlContainerGetResultsInner>() { + public Observable migrateToManualThroughputSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return migrateToManualThroughputSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public SqlContainerGetResultsInner call(ServiceResponse response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Create or update an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. - * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> createUpdateSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + public Observable> migrateToManualThroughputSqlDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1278,83 +1276,68 @@ public Observable> createUpdateSqlC if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - if (containerName == null) { - throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); - } - if (createUpdateSqlContainerParameters == null) { - throw new IllegalArgumentException("Parameter createUpdateSqlContainerParameters is required and cannot be null."); - } - Validator.validate(createUpdateSqlContainerParameters); final String apiVersion = "2020-03-01"; - Observable> observable = service.createUpdateSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, createUpdateSqlContainerParameters, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + Observable> observable = service.migrateToManualThroughputSqlDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Create or update an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. - * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the SqlContainerGetResultsInner object if successful. + * @return the ThroughputSettingsGetResultsInner object if successful. */ - public SqlContainerGetResultsInner beginCreateUpdateSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { - return beginCreateUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner beginMigrateToManualThroughputSqlDatabase(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateToManualThroughputSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); } /** - * Create or update an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. - * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginCreateUpdateSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginCreateUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters), serviceCallback); + public ServiceFuture beginMigrateToManualThroughputSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToManualThroughputSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Create or update an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. - * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the SqlContainerGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable beginCreateUpdateSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { - return beginCreateUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).map(new Func1, SqlContainerGetResultsInner>() { + public Observable beginMigrateToManualThroughputSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateToManualThroughputSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override - public SqlContainerGetResultsInner call(ServiceResponse response) { + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Create or update an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. - * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the SqlContainerGetResultsInner object + * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable> beginCreateUpdateSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + public Observable> beginMigrateToManualThroughputSqlDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1367,20 +1350,13 @@ public Observable> beginCreateUpdat if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - if (containerName == null) { - throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); - } - if (createUpdateSqlContainerParameters == null) { - throw new IllegalArgumentException("Parameter createUpdateSqlContainerParameters is required and cannot be null."); - } - Validator.validate(createUpdateSqlContainerParameters); final String apiVersion = "2020-03-01"; - return service.beginCreateUpdateSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, createUpdateSqlContainerParameters, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.beginMigrateToManualThroughputSqlDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginCreateUpdateSqlContainerDelegate(response); + ServiceResponse clientResponse = beginMigrateToManualThroughputSqlDatabaseDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1389,74 +1365,71 @@ public Observable> call(Response beginCreateUpdateSqlContainerDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse beginMigrateToManualThroughputSqlDatabaseDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(ErrorResponseException.class) .build(response); } /** - * Deletes an existing Azure Cosmos DB SQL container. + * Lists the SQL container under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<SqlContainerGetResultsInner> object if successful. */ - public void deleteSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { - deleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().last().body(); + public List listSqlContainers(String resourceGroupName, String accountName, String databaseName) { + return listSqlContainersWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); } /** - * Deletes an existing Azure Cosmos DB SQL container. + * Lists the SQL container under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture deleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + public ServiceFuture> listSqlContainersAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listSqlContainersWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); } /** - * Deletes an existing Azure Cosmos DB SQL container. + * Lists the SQL container under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request + * @return the observable to the List<SqlContainerGetResultsInner> object */ - public Observable deleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { - return deleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, Void>() { + public Observable> listSqlContainersAsync(String resourceGroupName, String accountName, String databaseName) { + return listSqlContainersWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1>, List>() { @Override - public Void call(ServiceResponse response) { + public List call(ServiceResponse> response) { return response.body(); } }); } /** - * Deletes an existing Azure Cosmos DB SQL container. + * Lists the SQL container under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. - * @param containerName Cosmos DB container name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request + * @return the observable to the List<SqlContainerGetResultsInner> object */ - public Observable> deleteSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + public Observable>> listSqlContainersWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1469,16 +1442,35 @@ public Observable> deleteSqlContainerWithServiceResponseAs if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - if (containerName == null) { - throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); - } final String apiVersion = "2020-03-01"; - Observable> observable = service.deleteSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return service.listSqlContainers(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listSqlContainersDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listSqlContainersDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); } /** - * Deletes an existing Azure Cosmos DB SQL container. + * Gets the SQL container under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1487,13 +1479,14 @@ public Observable> deleteSqlContainerWithServiceResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SqlContainerGetResultsInner object if successful. */ - public void beginDeleteSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { - beginDeleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); + public SqlContainerGetResultsInner getSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); } /** - * Deletes an existing Azure Cosmos DB SQL container. + * Gets the SQL container under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1503,40 +1496,614 @@ public void beginDeleteSqlContainer(String resourceGroupName, String accountName * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginDeleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginDeleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + public ServiceFuture getSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); } /** - * Deletes an existing Azure Cosmos DB SQL container. + * Gets the SQL container under an existing Azure Cosmos DB database account. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param containerName Cosmos DB container name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable to the SqlContainerGetResultsInner object */ - public Observable beginDeleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { - return beginDeleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, Void>() { + public Observable getSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, SqlContainerGetResultsInner>() { @Override - public Void call(ServiceResponse response) { + public SqlContainerGetResultsInner call(ServiceResponse response) { return response.body(); } }); } /** - * Deletes an existing Azure Cosmos DB SQL container. + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlContainerGetResultsInner object + */ + public Observable> getSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.getSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSqlContainerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSqlContainerDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SqlContainerGetResultsInner object if successful. + */ + public SqlContainerGetResultsInner createUpdateSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return createUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createUpdateSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return createUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).map(new Func1, SqlContainerGetResultsInner>() { + @Override + public SqlContainerGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (createUpdateSqlContainerParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateSqlContainerParameters is required and cannot be null."); + } + Validator.validate(createUpdateSqlContainerParameters); + final String apiVersion = "2020-03-01"; + Observable> observable = service.createUpdateSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, createUpdateSqlContainerParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SqlContainerGetResultsInner object if successful. + */ + public SqlContainerGetResultsInner beginCreateUpdateSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return beginCreateUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateUpdateSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlContainerGetResultsInner object + */ + public Observable beginCreateUpdateSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return beginCreateUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).map(new Func1, SqlContainerGetResultsInner>() { + @Override + public SqlContainerGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlContainerGetResultsInner object + */ + public Observable> beginCreateUpdateSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (createUpdateSqlContainerParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateSqlContainerParameters is required and cannot be null."); + } + Validator.validate(createUpdateSqlContainerParameters); + final String apiVersion = "2020-03-01"; + return service.beginCreateUpdateSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, createUpdateSqlContainerParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateSqlContainerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateSqlContainerDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { + deleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return deleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + Observable> observable = service.deleteSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDeleteSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { + beginDeleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginDeleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.beginDeleteSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteSqlContainerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteSqlContainerDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner getSqlContainerThroughput(String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable getSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> getSqlContainerThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.getSqlContainerThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSqlContainerThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSqlContainerThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner updateSqlContainerThroughput(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).toBlocking().last().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable for the request */ - public Observable> beginDeleteSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + public Observable> updateSqlContainerThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1552,13 +2119,106 @@ public Observable> beginDeleteSqlContainerWithServiceRespo if (containerName == null) { throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); final String apiVersion = "2020-03-01"; - return service.beginDeleteSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Observable> observable = service.updateSqlContainerThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginUpdateSqlContainerThroughput(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).toBlocking().single().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginUpdateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginUpdateSqlContainerThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2020-03-01"; + return service.beginUpdateSqlContainerThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginDeleteSqlContainerDelegate(response); + ServiceResponse clientResponse = beginUpdateSqlContainerThroughputDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1567,32 +2227,32 @@ public Observable> call(Response response) { }); } - private ServiceResponse beginDeleteSqlContainerDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginUpdateSqlContainerThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) - .register(204, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } /** - * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param containerName Cosmos DB container name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ - public ThroughputSettingsGetResultsInner getSqlContainerThroughput(String resourceGroupName, String accountName, String databaseName, String containerName) { - return getSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner migrateToAutoscaleSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { + return migrateToAutoscaleSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().last().body(); } /** - * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1602,12 +2262,93 @@ public ThroughputSettingsGetResultsInner getSqlContainerThroughput(String resour * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + public ServiceFuture migrateToAutoscaleSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToAutoscaleSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); } /** - * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable migrateToAutoscaleSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return migrateToAutoscaleSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> migrateToAutoscaleSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + Observable> observable = service.migrateToAutoscaleSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginMigrateToAutoscaleSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginMigrateToAutoscaleSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginMigrateToAutoscaleSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToAutoscaleSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + } + + /** + * Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. @@ -1616,8 +2357,8 @@ public ServiceFuture getSqlContainerThroughpu * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable getSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { - return getSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, ThroughputSettingsGetResultsInner>() { + public Observable beginMigrateToAutoscaleSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginMigrateToAutoscaleSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); @@ -1626,7 +2367,7 @@ public ThroughputSettingsGetResultsInner call(ServiceResponse> getSqlContainerThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + public Observable> beginMigrateToAutoscaleSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1652,12 +2393,12 @@ public Observable> getSqlCont throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); } final String apiVersion = "2020-03-01"; - return service.getSqlContainerThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.beginMigrateToAutoscaleSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = getSqlContainerThroughputDelegate(response); + ServiceResponse clientResponse = beginMigrateToAutoscaleSqlContainerDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1666,59 +2407,57 @@ public Observable> call(Respo }); } - private ServiceResponse getSqlContainerThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginMigrateToAutoscaleSqlContainerDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) .build(response); } /** - * Update RUs per second of an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param containerName Cosmos DB container name. - * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ - public ThroughputSettingsGetResultsInner updateSqlContainerThroughput(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return updateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).toBlocking().last().body(); + public ThroughputSettingsGetResultsInner migrateToManualThroughputSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { + return migrateToManualThroughputSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().last().body(); } /** - * Update RUs per second of an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param containerName Cosmos DB container name. - * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters), serviceCallback); + public ServiceFuture migrateToManualThroughputSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToManualThroughputSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); } /** - * Update RUs per second of an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param containerName Cosmos DB container name. - * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable updateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return updateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + public Observable migrateToManualThroughputSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return migrateToManualThroughputSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); @@ -1727,17 +2466,16 @@ public ThroughputSettingsGetResultsInner call(ServiceResponse> updateSqlContainerThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + public Observable> migrateToManualThroughputSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1753,61 +2491,54 @@ public Observable> updateSqlC if (containerName == null) { throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); } - if (updateThroughputParameters == null) { - throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); - } - Validator.validate(updateThroughputParameters); final String apiVersion = "2020-03-01"; - Observable> observable = service.updateSqlContainerThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + Observable> observable = service.migrateToManualThroughputSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Update RUs per second of an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param containerName Cosmos DB container name. - * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ThroughputSettingsGetResultsInner object if successful. */ - public ThroughputSettingsGetResultsInner beginUpdateSqlContainerThroughput(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return beginUpdateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).toBlocking().single().body(); + public ThroughputSettingsGetResultsInner beginMigrateToManualThroughputSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginMigrateToManualThroughputSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); } /** - * Update RUs per second of an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param containerName Cosmos DB container name. - * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginUpdateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginUpdateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters), serviceCallback); + public ServiceFuture beginMigrateToManualThroughputSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToManualThroughputSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); } /** - * Update RUs per second of an Azure Cosmos DB SQL container. + * Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param containerName Cosmos DB container name. - * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ThroughputSettingsGetResultsInner object */ - public Observable beginUpdateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { - return beginUpdateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + public Observable beginMigrateToManualThroughputSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginMigrateToManualThroughputSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, ThroughputSettingsGetResultsInner>() { @Override public ThroughputSettingsGetResultsInner call(ServiceResponse response) { return response.body(); @@ -1816,17 +2547,16 @@ public ThroughputSettingsGetResultsInner call(ServiceResponse> beginUpdateSqlContainerThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + public Observable> beginMigrateToManualThroughputSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1842,17 +2572,13 @@ public Observable> beginUpdat if (containerName == null) { throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); } - if (updateThroughputParameters == null) { - throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); - } - Validator.validate(updateThroughputParameters); final String apiVersion = "2020-03-01"; - return service.beginUpdateSqlContainerThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.beginMigrateToManualThroughputSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = beginUpdateSqlContainerThroughputDelegate(response); + ServiceResponse clientResponse = beginMigrateToManualThroughputSqlContainerDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1861,11 +2587,11 @@ public Observable> call(Respo }); } - private ServiceResponse beginUpdateSqlContainerThroughputDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginMigrateToManualThroughputSqlContainerDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(ErrorResponseException.class) .build(response); } diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/TableResourcesImpl.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/TableResourcesImpl.java index bcbd688fb429e..a0477344a04b1 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/TableResourcesImpl.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/TableResourcesImpl.java @@ -116,4 +116,28 @@ public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner }); } + @Override + public Observable migrateToAutoscaleTableAsync(String resourceGroupName, String accountName, String tableName) { + TableResourcesInner client = this.inner(); + return client.migrateToAutoscaleTableAsync(resourceGroupName, accountName, tableName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable migrateToManualThroughputTableAsync(String resourceGroupName, String accountName, String tableName) { + TableResourcesInner client = this.inner(); + return client.migrateToManualThroughputTableAsync(resourceGroupName, accountName, tableName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + } diff --git a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/TableResourcesInner.java b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/TableResourcesInner.java index d25e759542be2..5281ef2bb7663 100644 --- a/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/TableResourcesInner.java +++ b/sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/TableResourcesInner.java @@ -11,6 +11,7 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.cosmosdb.v2020_03_01.ErrorResponseException; import com.microsoft.azure.management.cosmosdb.v2020_03_01.TableCreateUpdateParameters; import com.microsoft.azure.management.cosmosdb.v2020_03_01.ThroughputSettingsUpdateParameters; import com.microsoft.rest.ServiceCallback; @@ -26,6 +27,7 @@ import retrofit2.http.Headers; import retrofit2.http.HTTP; import retrofit2.http.Path; +import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Query; import retrofit2.Response; @@ -94,6 +96,22 @@ interface TableResourcesService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default") Observable> beginUpdateTableThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.TableResources migrateToAutoscaleTable" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale") + Observable> migrateToAutoscaleTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.TableResources beginMigrateToAutoscaleTable" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale") + Observable> beginMigrateToAutoscaleTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.TableResources migrateToManualThroughputTable" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput") + Observable> migrateToManualThroughputTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2020_03_01.TableResources beginMigrateToManualThroughputTable" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput") + Observable> beginMigrateToManualThroughputTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -895,4 +913,336 @@ private ServiceResponse beginUpdateTableThrou .build(response); } + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner migrateToAutoscaleTable(String resourceGroupName, String accountName, String tableName) { + return migrateToAutoscaleTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).toBlocking().last().body(); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture migrateToAutoscaleTableAsync(String resourceGroupName, String accountName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToAutoscaleTableWithServiceResponseAsync(resourceGroupName, accountName, tableName), serviceCallback); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable migrateToAutoscaleTableAsync(String resourceGroupName, String accountName, String tableName) { + return migrateToAutoscaleTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> migrateToAutoscaleTableWithServiceResponseAsync(String resourceGroupName, String accountName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + Observable> observable = service.migrateToAutoscaleTable(this.client.subscriptionId(), resourceGroupName, accountName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginMigrateToAutoscaleTable(String resourceGroupName, String accountName, String tableName) { + return beginMigrateToAutoscaleTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).toBlocking().single().body(); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginMigrateToAutoscaleTableAsync(String resourceGroupName, String accountName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToAutoscaleTableWithServiceResponseAsync(resourceGroupName, accountName, tableName), serviceCallback); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginMigrateToAutoscaleTableAsync(String resourceGroupName, String accountName, String tableName) { + return beginMigrateToAutoscaleTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginMigrateToAutoscaleTableWithServiceResponseAsync(String resourceGroupName, String accountName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.beginMigrateToAutoscaleTable(this.client.subscriptionId(), resourceGroupName, accountName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginMigrateToAutoscaleTableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginMigrateToAutoscaleTableDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner migrateToManualThroughputTable(String resourceGroupName, String accountName, String tableName) { + return migrateToManualThroughputTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).toBlocking().last().body(); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture migrateToManualThroughputTableAsync(String resourceGroupName, String accountName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateToManualThroughputTableWithServiceResponseAsync(resourceGroupName, accountName, tableName), serviceCallback); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable migrateToManualThroughputTableAsync(String resourceGroupName, String accountName, String tableName) { + return migrateToManualThroughputTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> migrateToManualThroughputTableWithServiceResponseAsync(String resourceGroupName, String accountName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + Observable> observable = service.migrateToManualThroughputTable(this.client.subscriptionId(), resourceGroupName, accountName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginMigrateToManualThroughputTable(String resourceGroupName, String accountName, String tableName) { + return beginMigrateToManualThroughputTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).toBlocking().single().body(); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginMigrateToManualThroughputTableAsync(String resourceGroupName, String accountName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMigrateToManualThroughputTableWithServiceResponseAsync(resourceGroupName, accountName, tableName), serviceCallback); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginMigrateToManualThroughputTableAsync(String resourceGroupName, String accountName, String tableName) { + return beginMigrateToManualThroughputTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginMigrateToManualThroughputTableWithServiceResponseAsync(String resourceGroupName, String accountName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2020-03-01"; + return service.beginMigrateToManualThroughputTable(this.client.subscriptionId(), resourceGroupName, accountName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginMigrateToManualThroughputTableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginMigrateToManualThroughputTableDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + }